TypeScript Cheat Sheet
|
This section documents the current TypeScript release line as published at the official TypeScript documentation, which is the reference these pages are written and verified against. No specific patch version is pinned. This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production, since TypeScript iterates quickly. This section’s bibliography lists the reference material consulted while preparing these pages. |
A single-page, colour-coded summary of the TypeScript essentials — the install and compile one-liners, the
primitives alongside any / unknown / never, array and tuple syntax, object types and the
interface-vs-type decision, the narrowing guards and discriminated unions, function signatures and
overloads, classes, generics and their constraints, the type operators (keyof, typeof, indexed access,
conditional, mapped and template-literal types), the utility types, the assertion forms and satisfies, enums
vs. literal unions, modules and import type, the strict-family and emit compiler options, both decorator
systems, and a closing "erased vs. emitted" strip — handy for quick memorization or as a printable desk
reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Getting started — Getting Started with TypeScript.
Core type system — The Type System, Everyday Types, Unions and Narrowing, and Objects and Interfaces.
Functions, arrays and classes — Functions, Arrays and Tuples, and Classes.
Generics and type-level programming — Generics, Type Manipulation, Utility Types, Type Assertions and Modifiers, and Enums and Literal Alternatives.
Modules, declarations and JavaScript interop — Modules, Declaration Files, and JavaScript Interop and Migration.
Configuration and build — tsconfig.json and Compiler Options and Project References and Build.
Language extensions — Decorators and Metadata, JSX and Frameworks, and Async, Iterators and Generators.
The official TypeScript cheat sheets cover the same ground in four separate printable sheets (types, interfaces, classes, and control flow analysis).