Typescript Types
A utility types library for Typescript.
Types
The types included in this library are categorized by their purpose.
Test Types
| Type | Description |
|---|---|
IsAny<T> |
true if T is any, false otherwise (null, undefined also yield false) |
IsNever<T> |
true if T is never, false otherwise (null, undefined, any also yield false) |
If<Test, TrueBranch, FalseBranch> |
Returns TrueBranch if Test is true, FalseBranch otherwise1 . |
[IsKeyOf<T, K>][] |
true if K is a key of T, false otherwise. If T is any, any K but never will yield true. |
[IsEmptyString<S>][] |
true if S is the empty string '', false otherwise.2 |
Extraction Types
| Type | Description |
|---|---|
OptionalKeysOf<T> |
A union of all keys of T that are marked as optional. If T is a union, a union of the optional keys of all union members of T is returned3 . |
Combination Types
| Type | Description |
|---|---|
Assign<Shape, Defaults, Obj> |
Return a type with the structure of Shape and value types from Obj or Default for missing optional keys in Obj. |