TypeScript’s
never
type is very under-discussed, because it’s not nearly as ubiquitous or inescapable as other types. A TypeScript beginner can probably ignorenever
type as it only appears when dealing with advanced types, such as conditional types, or reading their cryptic type error messages.The
never
type does have quite a few good use cases in TypeScript. However, it also has its own pitfalls you need to be careful of.In this blog post, I will cover:
- The meaning of
never
type and why we need it.- Practical applications and pitfalls of
never
.- a lot of puns
Read in full here:
This thread was posted by one of our members via one of our news source trackers.