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

One of the guiding principles of Typescript is that it compiles to javascript. There isn't really a generally correct and practical way to do arbitrary type checking at runtime. For many types there is, such as using `instanceof` or `typeof`, but those don't work for testing interface compliance. Also, any type with a generic parameter is going to be hit-or-miss.


Not just compiles to JavaScript, it compiles simply via type erasure and lacks a runtime.




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

Search: