A free, self-paced textbook in 8 chapters. Read a chapter, then drill it with the 51 companion flashcards using spaced repetition.
TypeScript is a statically typed superset of JavaScript developed by Microsoft. Because it builds on top of JavaScript, every valid JavaScript file is also a valid TypeScript file,...
TypeScript's type system starts with a small set of primitive types: number, string, boolean, null, undefined, symbol, and bigint. These primitives serve as the building blocks for...
TypeScript supports multiple ways to express collections of values. Arrays can be written using either bracket syntax, such as let numbers: number[] = [1, 2, 3];, or the generic Ar...
Interfaces describe the shape of objects by declaring the names and types of their members. A simple interface Person { name: string; age: number; } tells the compiler that any val...
Classes in TypeScript follow standard JavaScript class syntax with the addition of type annotations. A class such as class Animal { name: string; constructor(name: string) { this.n...
Generics let you write functions, interfaces, and classes that operate on multiple types while preserving full type safety. A generic identity function written as function identity...
TypeScript supports ES module syntax: import { ModuleName } from './module'; pulls in named exports, import * as Module from './module'; imports a whole namespace, and exports are...
Strict mode, enabled by setting "strict": true in tsconfig.json, turns on a collection of more rigorous type-checking options, including strictNullChecks and several others. Activa...