3 ms·
TypeScript supports 'function f(x: any): x is T' as a way to declare that if f returns true, x may pass as type T https://www.typescriptlang.org/docs/handbook/
by __s 7y ago
TypeScript supports 'function f(x: any): x is T' as a way to declare that if f returns true, x may pass as type T
https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards https://www.typescriptlang.org/docs/handbook/advanced-types....
- cyral 7y agoThis package has an index.d.ts file that utilizes exactly this.