Command Palette

Search for a command to run...

Hectal
Phase 11: Modules and Declaration Files
TypeScript · Exercise 2 of 5 PreviousNext
Beginner

Merge two interfaces

Account is declared once with id. The code below creates an account with a balance too, which the checker rejects.

Without editing the first declaration, add a second interface Account that adds balance: number. Interfaces with the same name merge. The program must print balance: 50.

What Check tests

  1. Your code has no type errors
  2. The program prints balance: 50
  3. An Account without a balance is rejected
  4. An Account with both members is accepted

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.