TypeScript features by topic
Every TypeScript feature on this site is explained once, in one of eight topic hubs. Each hub groups the features that solve the same kind of problem and gives every feature its own section with a sample compiled with TypeScript 7.0.2, the real compiler errors, pitfalls and interview questions. Use the tables below to find a feature; use the topic hubs overview for a reading order, and TypeScript versions to see what a particular release added.
New to TypeScript? Start with the four basics tutorials: types and inference, functions and generics, objects and classes, and modules and compilation.
The eight hubs
Section titled “The eight hubs”| Hub | What it covers |
|---|---|
| Core type system | Interfaces, union and intersection types, tuples, index signatures and const assertions. |
| Type narrowing | Strict null checks, type guards and predicates, discriminated unions, type assertions and satisfies. |
| Generics and functions | Generics, constraints, defaults and const type parameters, overloads and async functions. |
| Classes and decorators | Access modifiers, parameter properties, abstract classes, override, this parameters and decorators. |
| Advanced types | keyof, typeof, indexed access, conditional types, mapped types and template literal types. |
| Utility types | Partial, Required, Pick, Omit, Readonly, Record, Exclude, Extract, NonNullable and function types. |
| Declarations and modules | Declaration files, declaration merging, module augmentation and namespaces. |
| Tooling and project structure | Strict mode, module settings, type-only imports, erasable syntax, project references and TypeScript 7. |
Type modeling
Section titled “Type modeling”| Feature | Since | Where it is explained |
|---|---|---|
| Interfaces | 0.8 | Core type system: Interfaces |
| Union and literal types | 1.4 | Core type system: Union types |
| Intersection types | 1.6 | Core type system: Intersection types |
| Tuple types, optional and rest elements, labels | 1.3, 3.0, 4.0 | Core type system: Tuple types |
| Index signatures and pattern keys | early, 4.4 | Core type system: Index signatures |
Const assertions (as const) |
3.4 | Core type system: Const assertions |
| Type aliases versus interfaces | 1.4 | Basics: Types versus interfaces |
any, unknown and never |
early, 3.0, 2.0 | Basics: Any unknown and never |
Narrowing and safety
Section titled “Narrowing and safety”| Feature | Since | Where it is explained |
|---|---|---|
| Strict null checks | 2.0 | Type narrowing: Strict null checks |
Type guards, type predicates, in narrowing |
1.4, 1.6, 2.7 | Type narrowing: Type guards |
| Assertion functions, inferred type predicates | 3.7, 5.5 | Type narrowing: Type guards |
| Discriminated unions and exhaustiveness | 2.0 | Type narrowing: Discriminated unions |
Type assertions (as), non-null assertion (!) |
1.6, 2.0 | Type narrowing: Type assertions |
The satisfies operator |
4.9 | Type narrowing: Type assertions |
Functions and classes
Section titled “Functions and classes”| Feature | Since | Where it is explained |
|---|---|---|
| Generics | 0.9 | Generics and functions: Generics |
Constraints, defaults, const type parameters |
0.9, 2.3, 5.0 | Generics and functions: Constraints and defaults |
| Function overloads | early | Generics and functions: Function overloads |
Async functions, Awaited, unknown in catch |
1.7 and 2.1, 4.5, 4.4 | Generics and functions: Async functions |
Access modifiers, parameter properties, readonly |
0.8 to 2.0 | Classes: Access modifiers |
Abstract classes, implements |
1.6 | Classes: Abstract classes |
override, strict property initialization |
4.3, 2.7 | Classes: Override |
this parameters |
2.0 | Classes: This parameters |
| Decorators (standard and legacy) | 5.0, 1.5 | Classes: Decorators |
Type manipulation and utility types
Section titled “Type manipulation and utility types”| Feature | Since | Where it is explained |
|---|---|---|
keyof, typeof, indexed access types |
2.1 | Advanced types: Type operators |
Conditional types and infer |
2.8 | Advanced types: Conditional types |
| Mapped types and key remapping | 2.1, 4.1 | Advanced types: Mapped types |
| Template literal types | 4.1 | Advanced types: Template literal types |
Partial |
2.1 | Utility types: Partial |
Required |
2.8 | Utility types: Required |
Pick and Omit |
2.1, 3.5 | Utility types: Pick and Omit |
Readonly and Record |
2.1 | Utility types: Readonly and Record |
Exclude and Extract |
2.8 | Utility types: Exclude and Extract |
NonNullable |
2.8 | Utility types: NonNullable |
Parameters, ReturnType, ConstructorParameters, InstanceType |
3.1, 2.8 | Utility types: Function and constructor types |
Declarations and tooling
Section titled “Declarations and tooling”| Feature | Since | Where it is explained |
|---|---|---|
Declaration files and @types |
0.8 | Declarations: Declaration files |
| Declaration merging | 0.8 | Declarations: Declaration merging |
| Module and global augmentation | 1.8 | Declarations: Module augmentation |
| Namespaces | 1.5 | Declarations: Namespaces |
ES modules and import type |
1.5, 3.8 | Basics: Modules and imports |
strict and its family of checks |
2.3 | Tooling: Strict mode |
module and moduleResolution (nodenext, bundler) |
4.7, 5.0 | Tooling: Module settings |
verbatimModuleSyntax, erasableSyntaxOnly |
5.0, 5.8 | Tooling: Type-only imports and erasable syntax |
| Project references | 3.0 | Tooling: Project references |
| Native compiler | 7.0 | Tooling: TypeScript 7 |
JavaScript features used from TypeScript
Section titled “JavaScript features used from TypeScript”TypeScript supports every modern JavaScript feature and adds types to it. These are explained in the JavaScript section, not repeated here: classes, private fields, async functions, modules, optional chaining, nullish coalescing, spread and rest, destructuring and template literals. The JavaScript features index lists the rest.