re: How TypeScript squashed all known bugs VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I still confused, for example, I create a method like this; function aTypeScriptMethod(age: number) { } And backend data returns like that; ...
 

In the end, nobody replied to the question. You need to use a type guard for this. It is when static typing becomes dynamic. You have to manually check each field in the payload by typeof. Check the official docs.
typescriptlang.org/docs/handbook/a...

code of conduct - report abuse