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;
type Properties = { [key: string]: Type };
type InstanceShape = { [K in keyof T]: T[K] extends Type ? X : never }
_________________________
https://www.typescriptlang.org/docs/handbook/advanced-types.html
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
via:
type InstanceShape
_________________________
References:
https://www.typescriptlang.org/docs/handbook/advanced-types.html
Comments
Post a Comment