3 ms·
With your library one has to write types twice. I understand that it’s not TypeScript’s job at the moment, but it’d be great to enable runtime checks with the
by wonderlg 6y ago
With your library one has to write types twice.
I understand that it’s not TypeScript’s job at the moment, but it’d be great to enable runtime checks with the flick of a switch without typing extra code.
function upper(s: string) {
return s.toUpperCase();
}
This function could have a nice implicit TypeError instead of “undefined is not a function”
- jakelazaroff 6y agoI’m not sure what you mean. My library has a `TypeOf` type that lets you extract static type information from validation functions. And calling `toUpperCase` on undefined already results in a TypeError.