4 ms·
You can read the proposal and discussion around the feature on the github suggestion page for this feature. The initial suggestion was made because there are c
by dsp1234 10y ago
You can read the proposal and discussion around the feature on the github suggestion page for this feature.
The initial suggestion was made because there are certain functions in JavaScript that expect a non-primitive type in order to function. Such as Object.create, Object.getPrototypeOf, etc. Previous to this there was no way to model the functions with type safety, such that a developer would be prevented from accidentally sending a primitive value into those functions. This is because Typescript doesn't have the ability to say "Any type except X, Y and Z". So a new type was needed for this.
https://github.com/Microsoft/TypeScript/issues/1809 https://github.com/Microsoft/TypeScript/issues/1809
- realharo 10y agoThanks. Sounds useful especially for library authors.