Course lesson

Implement and Type Enum-Style Objects in TypeScript

In this lesson, we're going to learn how we can use const assertions to implement an enum-style object in TypeScript. We generally don't want widening of any literal types in this object, so we can use a const assertion. We're also going to compare our...

Duration
4 min
Access
Pro
Transcript
Available

In this lesson, we're going to learn how we can use const assertions to implement an enum-style object in TypeScript. We generally don't want widening of any literal types in this object, so we can use a const assertion. We're also going to compare our enum-style object to a native TypeScript enum.