Menu

Basic Types

Module 2: Basic Types

Introduction

Every TypeScript program is built from a small set of basic types. Strings, numbers, and booleans describe single values; arrays and tuples describe lists; and special types such as unknown and never describe values that are uncertain or impossible.

This module covers each basic type, when to write a type yourself, and when to let TypeScript work it out for you. You will also learn literal types, which let a variable accept only specific values, such as 'pending' or 'delivered'.

What you will learn in this module

  • When to write type annotations and when to rely on inference
  • How to use string, number, boolean, bigint, symbol, null, and undefined
  • How to type arrays, read-only arrays, and tuples
  • When to use any, unknown, void, and never
  • How literal types and as const restrict values to an exact set

TypeScript Tutorial

J

Jebasta





Get in Touch For Details