Doesn't seem to be an explicit place with this information:
I have always named interface files as IMyInterfaceName.extension
and the interface as IMyInterface
.
Is that the way to go with Angular 2 and Typescript?
Thanks :)
Do use consistent names for all assets named after what they represent. Do use upper camel case for class names. Do match the name of the symbol to the name of the file. Do append the symbol name with the conventional suffix (such as Component , Directive , Module , Pipe , or Service ) for a thing of that type.
An interface is a way to define a contract on a function with respect to the arguments and their type. Along with functions, an interface can also be used with a Class as well to define custom types. An interface is an abstract type, it does not contain any code as a class does.
To solve this, TypeScript introduces the concept of interfaces. By convention, the interface names are in the camel case. They use a single capitalized letter to separate words in there names.
According to NAMING.md.
In general Angular2 should follow TypeScript naming conventions. See: 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 I or Interface in the name or any other way of identifying it as an interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With