Command Palette

Search for a command to run...

Hectal
Phase 1: Basic Types and Annotations
TypeScript · Exercise 1 of 6Next
Beginner

Annotate a Whole Function

Strict mode reports the parameters of perimeter because nobody typed them. Add a type to both parameters and a return type to the function.

The checks call perimeter("3", 4) and expect TypeScript to reject it.

What Check tests

  1. Your code has no type errors
  2. The console prints 14
  3. A text argument is rejected
  4. The return type is written down

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.