Caffeinated Coder
Book an appointment
Lesson 02 · Typing JavaScript

Basic types

A type annotation labels a variable's box with the kind of value it may hold. Step through a six-line program as "Mia" goes into a string box, 12 into a number box, true into a boolean box and a list into a number[] box that grows, then watch tsc refuse the string "twelve" in a number box with error TS2322, before anything runs.

9 min9 steps5 questionsBeginner
Fig 2 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.