DEV Community

Discussion on: How TypeScript squashed all known bugs

Collapse
 
olvnikon profile image
Vladimir

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...