DEV Community

Discussion on: Type Narrowing in TypeScript

Collapse
jack_garrus profile image
Nadia Guarracino

First of all thank you for the article, It was very clear!

Just a question out of curiosity: why did you use the type and not an interface for the example in the Discriminated Unions paragraph?

Collapse
mainawycliffe profile image
Maina Wycliffe Author

Thanks. To be honest, no reason, just a forceful habit. Over the years, the gap between interfaces and types aliases keeps closing and as of the moment, they can be mostly interchanged without major issue. I use type aliases mostly for consistency and it became a habit.