Command Palette

Search for a command to run...

Hectal
Phase 12: The Compiler and tsconfig
TypeScript · Exercise 6 of 6 Previous
Intermediate

Rewrite for Type Stripping

This file's tsconfig turns on erasableSyntaxOnly, so it can run under Node's built-in type stripping. The enum and the constructor parameter properties (public name) are not allowed.

Rewrite the file without them: a const object plus a type for Role, and a class with explicit fields. It must still print Asha 0.

What Check tests

  1. Your code has no type errors
  2. The console prints Asha 0
  3. There is no enum
  4. The constructor has no public, private, protected or readonly parameters

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.