Coding Styles
In this chapter you’ll find some high-level conventions for coding in TypeScript. If you’re looking for a thorough guide, check out idomatic.js[1] or AirBnB’s ES6 style guide[2].
#Types
- Arrays should be defined like this
type[]
, notArray<type>
. - Create an
interface
rather than using theany
type.
Theany
keyword should only be used if absolutely necessary.
#Naming
const
should use UPPEER_SNAKE_CASE[3]class
names should always be written in PascalCase.[4]interface
names should alawys start with a capital “I” and use PascalCase, e.g.IMarvelCharacter
.