The never Type and switch Statements
Learn about the never type and how it's used with switch statements in TypeScript.
We'll cover the following
The never
type
The final primitive type in the TypeScript collection is a type of never
. This type is used to indicate instances where something should never occur. Even though this
may sound confusing, we can often write code where this occurs.
Consider the following code:
Get hands-on with 1400+ tech skills courses.