3 ms·
> And I'll add - that exact style of code has been a source of bugs in our production codebase before. Very much this. That scenario will break if e.g. the bac
by lhorie 6y ago
> And I'll add - that exact style of code has been a source of bugs in our production codebase before.
Very much this. That scenario will break if e.g. the backend API changes. This is a constant source of frustration for someone I know, whose backend team has a habit of not communicating their changes to the frontend team.
There's nothing TS can do to enforce that the actual type of the response matches what the type declaration says (hence the need for runtime checks in this case).