TypeScript supports a rich set of type operators for working with types. Use Table A-1 as a handy reference for when you want to learn more about an operator.
Type operator | Syntax | Use it on | Learn more |
---|---|---|---|
Type query |
|
Any type |
|
Keys |
|
Object types |
|
Property lookup |
|
Object types |
|
Mapped type |
|
Object types |
|
Modifier addition |
|
Object types |
|
Modifier subtraction |
|
Object types |
|
Read-only modifier |
|
Object types, array types, tuple types |
“Objects”, “Classes and Inheritance”, “Read-only arrays and tuples” |
Optional modifier |
|
Object types, tuple types, function parameter types |
|
Conditional type |
|
Generic types, type aliases, function parameter types |
|
Non |
|
Nullable types |
|
Generic type parameter default |
|
Generic types |
|
Type assertion |
|
Any type |
|
Type guard |
|
Function return types |
3.144.189.177