Skip to content
Justice Tech School

Basic Types

TypeScript adds types to JavaScript. The basics are string, number, boolean, null and undefined. Types are checked before the code runs and then erased.

Example
const name: string = "Ada";
const age: number = 30;
const ok: boolean = true;
console.log(name, age, ok);

Result

Ada 30 true

Exercise

Annotate a number.

let n:  = 5;

Quiz Test

When are TypeScript types checked?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.