DEV Community

Discussion on: Get Started With TypeScript in 2019

Collapse
 
blindfish3 profile image
Ben Calder

You do of course need to type what you expect to get in the response and then use within your application. In my experience any unused data needn't be typed...

But this is one situation where IMO typings can give a false sense of security: API responses that are out of your control can (and often will) change unexpectedly - e.g. return null on a property where you don't expect it; so it's still important to have some guards in place to avoid responses that might crash your application.