mapping modifier
A plus or minus sign before readonly or the optional question mark in a mapped type, which adds or removes that modifier from every property.
In more detail
-readonly makes all properties writable and -? makes all properties required, which is how Required is built. + is the default and is rarely written.
Related terms
- mapped type — A type that builds a new object type by looping over a set of keys, such as { [K in keyof T]: T[K] }.
- readonly — A modifier, in languages such as C# and TypeScript, that lets a field or property be assigned only when it is initialised, never afterwards.
- Required<T> — The utility type that removes the question mark from every property of T, making all of them required.
Taught in
- Mapped Types, Key Remapping With as And Template Literals — Production TypeScript