1. Concept library
  2. JavaScript & TypeScript
  3. Module 1: Types, values and inference

Concept

Primitive types

TypeScript names the values JavaScript already has: string, number, boolean, null, undefined, bigint and symbol. Everything else is an object, and the compiler checks that you use each one as what it is.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Name TypeScript's primitive types and give an example value of each
  2. Explain the difference between null and undefined and when each appears
  3. Spot a value typed as string that holds a number at runtime and explain how it got there

In practice

A few lines that show Primitive types doing its job.

TypeScript
let title: string = "Report";
let pages: number = 12;
let draft: boolean = true;
let reviewer: string | null = null;

pages = "twelve";   // error: Type 'string' is not assignable to type 'number'
console.log(typeof reviewer);   // "object" at runtime, null in the type

The common mistake

Watch for

Treating null and undefined as interchangeable. They are different types and different values: a missing property is undefined, and null is what you assign on purpose. Model the one you actually use.

How it stays learned

Once a session shows you understand Primitive types, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on Primitive types.

Next in the moduleType inference →