- A class is a type that can be instantiated
- interfaces should be used to define a common pattern that many classes wants to implement
- 'any' is commonly used when integrating typescript with javascript libraries
- difference between type and interface: types can be inferred, interfaces cannot
-
Fancy english words:
- explicit: stated clearly and in detail, leaving no room for confusion or doubt.
- implicit: suggested though not directly expressed
-
Typescript concepts:
- type definitions
- classes, interfaces and types
- variable type definitions
- Example:
let test: string = 'hello';
- Can be explicit or implicit
- implicit:
const test = 'hello';
- explicit:
const test: string = 'hello';
- implicit:
- Special case:
const test = {foo: 'bar'}; // implicit type will be inferred by typescript
- Example:
- type definitions