...

/

Upgraded and Enhanced Enums

Upgraded and Enhanced Enums

Learn about the upgraded and enhanced enums of TypeScript 5.0.

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 ...