Troubleshooting Handbook: Operators
typeofandinstanceof: type query used for refinementkeyof: get keys of an object.keyof Tis an operator to tell you what values ofkcan be used forobj[k].O[K]: property lookup[K in O]: mapped types+or-orreadonlyor?: addition and subtraction and readonly and optional modifiersx ? Y : Z: Conditional types for generic types, type aliases, function parameter types!: Nonnull assertion for nullable types=: Generic type parameter default for generic typesas: type assertionis: type guard for function return types
Conditional Types are a difficult topic to get around so here are some extra resources:
- fully walked through explanation https://artsy.github.io/blog/2018/11/21/conditional-types-in-typescript/
- Bailing out and other advanced topics https://github.com/sw-yx/ts-spec/blob/master/conditional-types.md
- Basarat's video https://www.youtube.com/watch?v=SbVgPQDealg&list=PLYvdvJlnTOjF6aJsWWAt7kZRJvzw-en8B&index=2&t=0s
- Generics, Conditional types and Mapped types