JavaScript and TypeScript Runtime Type Systems (RTTS)

JavaScript  and TypeScript Runtime Type Systems (RTTS)

rough notes on a talk by Michel Weststrate 
https://www.youtube.com/watch?v=010daBQPFmw

JavaScript RTTS libraries:
- PropTypes
- json-schema
- tcomb

Libraries, Frameworks that include RTTS:

- form validation libraries (?)
- MobX-state-tree
- GraphQL

- flow-runtime (use static types, at run-time)

_________________________
Use run-time types, at design (coding) time!

TypeScript 'is' keyword

type Shape = (props: T) => (value:any) => value is InstanceShape;

via:

type Properties = { [key: string]: Type };

type InstanceShape = { [K in keyof T]: T[K] extends Type ? X : never }

_________________________
References:

https://www.typescriptlang.org/docs/handbook/advanced-types.html

Comments