Command Palette

Search for a command to run...

Hectal
Phase 5: Arrays, Tuples, Enums and Special Types
TypeScript · Exercise 3 of 6 PreviousNext
Beginner

Replace an Enum

Status is an enum, so label("ACTIVE") is rejected and the enum emits extra code. Replace it with an as const object named Status plus a type also named Status that is the union of its values.

The function label and the log lines should keep working. The checks use plain strings like "ACTIVE" and the word enum must be gone from your code.

What Check tests

  1. Your code has no type errors
  2. The plain string "ACTIVE" is accepted
  3. An unknown value is rejected
  4. No enum is left
  5. The console prints Welcome Blocked

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Console

Nothing printed yet.