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.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
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.