Better TypeScript Types
SydJS
A quick tour through some ways we can make our types work harder for us, to prevent unwanted nasties creeping in. We’ll cover ‘shrinking’ our types to better fit our problems, how to avoid repeating yourself, some TypeScript quirks to avoid, and we’ll try thinking about some TypeScript fundamentals in a different way.
Delivered at RubyConf AU 2020.
References:
- https://kentcdodds.com/blog/make-impossible-states-impossible
- https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
- https://michalzalecki.com/nominal-typing-in-typescript/
- https://spin.atomicobject.com/2018/01/15/typescript-flexible-nominal-typing/
- https://www.typescriptlang.org/docs/handbook/utility-types.html
- https://dev.to/busypeoples/notes-on-typescript-pick-exclude-and-higher-order-components-40cp
- https://medium.com/@martin_hotell/interface-vs-type-alias-in-typescript-2-7-2a8f1777af4c
- https://mariusschulz.com/blog/typescript-3-0-the-unknown-type
- https://gcanti.github.io/io-ts/
- https://basarat.gitbooks.io/typescript/