Classes, enums and modules
This part turns to classes with fields, constructors and parameter properties, public, private and protected, interfaces as contracts, abstract classes, static members and accessors. The part ends with enums, ES modules and the decorators a class can carry.
21
Classes
fields and methods, the this of a method, and instances made with new
Open
22
Constructors
a constructor method, parameter properties, and strict property initialisation
Open
23
Modifiers
public, private and protected members, and readonly fields
Open
24
implements
an interface as a contract, a class that implements several, and refactors the compiler checks
Open
25
Abstract classes
an abstract skeleton, abstract methods a subclass must write, and how it differs from an interface
Open
26
static
static fields shared by every instance, static factories, and this inside a static method
Open
27
Getters and setters
get and set, a setter that validates, backing fields, and when a plain field is better
Open
28
Enums
numeric, string and const enums, and the literal union that often replaces one
Open
29
ES modules
export and import, a default export, and the import extension the compiler wants
Open
30
Decorators
what a decorator is, class and method decorators, and the standard they now follow
Open