ReviseAlgo Logo

Generics

Default Type Parameters

Master Default Type Parameters (<T = DefaultType>) in TypeScript, providing fallback generic types for functions, interfaces, and classes.

Last Updated: July 29, 2026 10 min read

In TypeScript, Default Type Parameters allow you to specify a fallback type for a generic parameter . If a caller does not explicitly specify or provide a type that allows inference, TypeScript falls back to the default type.

1. Syntax for Default Type Parameters

Assign a default type using the = operator inside angle brackets :

2. Combining Constraints with Defaults

You can combine generic constraints (extends) with default parameters (=). The default type parameter MUST satisfy the constraint.

3. Parameter Order Rule for Defaults

Just like function default parameters, generic default parameters must come after all required generic type parameters without defaults.

4. Interactive Code Playground

Test default type parameters below:

5. Summary Table

ConceptSyntax ExampleMeaning
Default ParameterT defaults to string if unspecified
| Constrained Default | > | T must extend object and defaults to Record |