Example code for talk
The idea is that we take a small example piece of JavaScript and gradually introduce more type features from TypeScript to improve the domain model.
The snippits are:
- vanilla Javascript
- basic type
- union types
- type alias primitives (this is a trick exercise)
- tagged types
- use taghiro for tagged types
- add constraints to tagged types
- types can be verbs as well as nouns
- example builder type
The typescript snippits have compile errors, and the idea is by correcting them you will gradually move towards making illegal states unrepresentable.