You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds ability to create type-safe Record entities by assigning type to Record's value.
The implementation is based on adding type parameters to types, interfaces, and classes. It is implemented however in a backwards-compatible manner, so that opting in to type safety is optional.
Examples:
// before (unsafe)
const record = new Record(['name'], ['Alice'])
record.get('neam') // no errors
record.toObject().neam[0] // run-time (late) error
// after (safe)
const record = new Record<Person>(['name'], ['Alice'])
record.get('neam') // Error: does not exist
record.toObject().neam[0] // design-time (early) error
0 commit comments