Command Palette

Search for a command to run...

Hectal
Phase 12: The Compiler and tsconfig
TypeScript · Exercise 1 of 6Next
Beginner

Fix the Implicit any

Strict mode refuses two functions whose parameters have no types. Give every parameter a real type so the file type-checks, and don't use the word any.

average takes a list of numbers. describe takes an object with name (text) and age (number). The console must print 6 and Asha is 30, and average("4,8") must be rejected by TypeScript.

What Check tests

  1. Your code has no type errors
  2. average("4,8") is rejected by TypeScript
  3. The console prints 6 and Asha is 30
  4. The code does not use the type any

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.