TypeScript
From basic types to advanced generics and utility types.
Beginner
- What is TypeScript?: JavaScript with an extra layer that checks the *shape* of your data before your code ever runs.
- Basic Types: The built-in labels TypeScript uses for strings, numbers, booleans, arrays and fixed-shape lists.
- Interfaces: A named description of the properties an object must have and the type of each.
- Type Aliases: Give any type, not just an object shape, a reusable name.
- Functions with Types: Annotate a function's parameters and return value so TypeScript can check every call.
Intermediate
- Union & Intersection Types: Combine types with `|` for "one of these" and with `&` for "all of these, merged."
- Generics: Write a function or type once so it works with any type, while keeping that type checked.
- Enums: A named set of related constants under one type, so you refer to them by name instead of a raw value.
- Type Narrowing: How TypeScript works out which branch of a union you're holding at each point in the code.
- Utility Types: Built-in generic types that turn an existing type into a new one, so you don't redefine similar shapes by hand.
- Classes & Access Modifiers: Mark class properties and methods `public`, `private` or `protected` to control what outside code can touch.
Advanced
- Mapped Types: Build a new type by looping over every property of an existing type and transforming each one the same way.
- Conditional Types: A type that resolves to one of two types, chosen by a check done at compile time.
- Declaration Files (.d.ts): A file that describes the shape of existing JavaScript code, with no implementation, so TypeScript can check code that uses it.
- tsconfig & Strict Mode: The file that configures the TypeScript compiler, and the one setting that turns on its strongest safety checks.