Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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....



This package has an index.d.ts file that utilizes exactly this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: