COURSE · 6 chapters · 30 lessons

TypeScript

Add types to JavaScript and catch mistakes before you run anything

This picks up where the JavaScript course leaves off, so treat it as a stretch unit. Come back once you have finished variables, arrays, functions and classes. It is optional — heading straight to HTML & CSS is perfectly fine. See the JavaScript course

Read about this chapter

Declare what kind of value it is

  1. 01Your first TypeScriptWrite down what kind of value a variable is allowed to hold, and catch mistakes before you run anything.5 slides · 13 exercisesGo to the exercises
  2. 02The number and boolean typesTell number and boolean apart, so you never mix up a sum with a yes-or-no.5 slides · 13 exercisesGo to the exercises

Type arrays and functions

  1. 03Adding types to arraysWrite it like string[] so that even the contents of a collection are all the same kind.5 slides · 13 exercisesGo to the exercises
  2. 04Adding types to functionsWrite the type of what goes in and what comes out, so a wrong use turns up on the spot.5 slides · 13 exercisesGo to the exercises