Classes
- Use constructors for object creation. Use private/read-only fields
- Don’t use
Object.assign, instead, use setters or constructors. - Don’t create new modules - it produces some issues with module references
- All internal and external classes (such as DTOs, models, etc.) must have constructors
- Order of props/methods should be:
publicpropertiesprotectedpropertiesprivatepropertiesconstructorpublicmethodsprotectedmethodsprivatemethods
- All fields must be
readonlyin case they're immutable-
Array fields can also have
readonlytype in case they're immutable, e.g.:readonly someArrayField: readonly Type[]
-
- Internal classes shouldn't use vendor types