DEV Community

Discussion on: How TypeScript squashed all known bugs

Collapse
 
wilgert profile image
Wilgert Velinga

TypeScript does not do anything in this case. TypeScript only checks types at compile time while the types of the response from the backend is known only at run time. There are some tools/libraries that allow you to use TypeScript types at runtime like: github.com/gcanti/io-ts.

Collapse
 
integerman profile image
Matt Eland

That's really interesting. I'm honestly not sure how I feel about that type of a library as it's not just a simple transpile down to JavaScript, but the injection of runtime type checking. I'll have to think more about that but I have a pretty strong gut negative for whatever reason. Thanks for sharing the library. I learned something new there.