Search⌘ K

Accessing Enum Values

Explore how to access and utilize values in TypeScript enums. Understand the difference between numeric and string enums, and learn how TypeScript generates mappings for bidirectional access to enum names and values. This lesson helps you grasp enum usage for safer and more efficient TypeScript code.

TypeScript map objects to allow access

A variable set with an enum that has a number lets you access the enum name from the integer. However, an enum with string values does not have this capability. This means you can use the enum ...