typescript Angular 2 中接口的命名约定是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36101911/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:21:21  来源:igfitidea点击:

What is the name convention for interfaces in Angular 2?

angularjstypescriptangular

提问by Jose A

Doesn't seem to be an explicit place with this information:

似乎不是包含此信息的明确位置:

I have always named interface files as IMyInterfaceName.extensionand the interface as IMyInterface.

我一直将接口文件命名IMyInterfaceName.extensionIMyInterface.

Is that the way to go with Angular 2 and Typescript?

这是使用 Angular 2 和 Typescript 的方法吗?

Thanks :)

谢谢 :)

回答by Eric Martinez

According to NAMING.md.

根据NAME.md

In general Angular2 should follow TypeScript naming conventions. See: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines

一般来说,Angular2 应该遵循 TypeScript 命名约定。请参阅:https: //github.com/Microsoft/TypeScript/wiki/Coding-guidelines

This is what it says about interfaces:

这是关于接口的说明:

Interfaces:

Follow the same rules as Classes
Should not have Ior Interfacein the name or any other way of identifying it as an interface.

接口:

遵循与 Classes 相同的规则,名称中
不应包含IInterface,或以任何其他方式将其标识为接口。