Upgraded and Enhanced Enums
Learn about the upgraded and enhanced enums of TypeScript 5.0.
We'll cover the following...
We'll cover the following...
Introduction to enums
Enums—a handy (if somewhat underappreciated) way of defining a set of named constants—have greatly boosted TypeScript 5.0.
In the past, we could have accidentally passed an incorrect number to a function expecting an enum and gotten away with it. TypeScript 5.0 is a lot stricter. It will throw an error if there’s a mismatch. It now treats all enums as union enums, making them safer and ...