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

You can use type guards for something similar: https://www.typescriptlang.org/docs/handbook/advanced-types....


What they were getting at is that you can't observe T itself, only values passed in as type T


Keyword similar. I use type guards for other things (like typing JSON responses), but they can't solve this particular problem.




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

Search: