DEV Community

Discussion on: Type Narrowing in TypeScript

Collapse
 
mainawycliffe profile image
Maina Wycliffe

I would lean with discriminated unions over using the in operator because they are easier to use. With the in operator, you might find yourself writing more complex checks if two or more types have a lot of overlapping properties. For simple check though, you can use them interchangeably, with no issue at all.