default type parameter
A type parameter with a fallback type, written <Data, Err = Error>, used when the caller does not supply one.
In more detail
Defaults keep common uses short while allowing customisation. Parameters with defaults must come after those without, and a default may refer to earlier parameters. An inferred type still wins over the default.
Related terms
- generics — Types that take other types as parameters, so one definition works for many kinds of value.
Taught in
- Default Generic Arguments And Multi-Type Parameters — Production TypeScript
- Const Type Parameters: Retaining Literal Types In Functions — Production TypeScript