Last of Union
LastOfUnion<1 | 2 | 3> => 3
Union to Tuple
UnionToTuple<1 | 2 | 3> => [1, 2, 3]
TuplePush<[1, 2], 3> => [1, 2, 3]
TupleUnshift<[1, 2], 3> => [3, 1, 2]
TupleTail<[1, 2, 3]> => [2, 3]
TupleFirst<[1, 2, 3]> => 1
TupleLast<[1, 2, 3]> => 3
TupleBody<[1, 2, 3]> => [1, 2]
TupleConcat<[1, 2, 3], [4, 5]> => [1, 2, 3, 4, 5]
TupleN<T, 5> => [T, T, T, T, T]
Make all properties in T writeable
Writeable<readonly [1, 2, 3]> => [1, 2, 3]
Make all properties in T writeable
DeepWriteable<readonly [readonly [1]]> => [[1]]
Make all properties in T readonly
DeepReadonly<[[1]]> => readonly [readonly [1]]
Make all properties in T optional
DeepPartial<{ a: { b: 1 } }> => { a?: { b?: 1 } }
Make all properties in T required
DeepRequired<{ a?: { b?: 1 } }> => { a: { b: 1 } }
If A
does not extends E
, return never
MapKey<Map<K, V>> => K
MapValue<Map<K, V>> => V
SetValue<Set<T>> => T
GetKey<{ a: 1 }, 1> => 'a'
enum Foo { A, B, C }
GetKey<typeof Foo, Foo.B> => 'B'
PromiseValue<Promise<T>> => T
LiteralObj<{ a: 1 } & { b: 2 }> => { a: 1, b: 2 }
Structure like a linked list
Take the union of depth tuple items, same as T[number]
on Array
LinkedTupleUnion<[1, [2, [3]]]> => 1 | 2 | 3
Take Array Element Type
ArrayElement<1[]> => 1
Prompt typescript this type is an array
Flatten deep tuples
FlatTuple<[[1,[2]], [[[3]]]]> => [1, 2, 3]
Take key extract some value
KeyofExcludeValue<{ a: 1, b: 2, c: 3 }, 2 | 3> => 'a'
Take key extract some value
KeyofExtractValue<{ a: 1, b: 2, c: 3 }, 2 | 3> => 'b' | 'c'
Pick object by value
PickValue<{ a: 1, b: 2, c: 3 }, 2 | 3> => { b: 2, c: 3 }
Omit object by value
OmitValue<{ a: 1, b: 2, c: 3 }, 2 | 3> => { a: 1 }
Build Object from Entries
ObjFromEntries<['a', 1] | ['b', 2]> => { a: 1, b: 2 }
ObjKeys<{ a: 1, b: 2, c: 3 }> => 'a' | 'b' | 'c'
ObjKeys<{ a: 1, b: 2, c: 3 }> => 1 | 2 | 3
Get value by key for object key value entries
EntryValue<['a', 1] | ['b', 2], 'a'> => 1
Get key by value object key value entries
EntryKey<['a', 1] | ['b', 2], 1> => 'a'
Get all object field path deeply
ObjPath<{ a: { b: { c: 1 } }[] }> => "a" | `a.${number}` | "a.length" | "a.toString" | "a.toLocaleString" | "a.pop" | "a.push" | "a.concat" | "a.join" | "a.reverse" | "a.shift" | "a.slice" | "a.sort" | "a.splice" | "a.unshift" | ... 18 more ... | `a.${number}.b.c`
Get object value by field path deeply
ValByPath<{ a: { b: { c: 1 } }[] }, 'a.0.b.c'> => 1
Get all object [field path, value] entry deeply
ObjPathEntry<{ a: { b: { c: 1 } } }> => ["a", { b: { c: 1 } }] | ["a.b", { c: 1 }] | ["a.b.c", 1]
Key Value Pairl
Readonly Key Value Pairl
Any Pair
Get Key of Pair
Get Key of Pair
Generated using TypeDoc
Union to Intersection