Module: Types
Type Aliases
Effect
Ƭ Effect<Function>: (...args: Parameters<Function>) => void
Type parameters
| Name | Type |
|---|---|
Function | extends VariadicFunction |
Type declaration
▸ (...args): void
A simple side effect function descriptor.
Parameters
| Name | Type |
|---|---|
...args | Parameters<Function> |
Returns
void
Flatten
Ƭ Flatten<Source>: keyof Source extends keyof any[] ? `${number}` : keyof Source | keyof { [Key in keyof Source as Key extends string ? Source[Key] extends Record<string, unknown> ? `${Key}.${Flatten<Source[Key]>}` : Source[Key] extends any[] ? Source[Key] extends any[][] | Record<string, unknown>[] ? `${Key}.${number}` | `${Key}.${number}.${Flatten<Source[Key][number]>}` : `${Key}.${number}` : Key : never]: never }
Recursively flattens object type to a union of its keys combined through dot-notation.
Type parameters
| Name | Type |
|---|---|
Source | extends Record<string, unknown> | any[] |
Flattenable
Ƭ Flattenable: Record<string, unknown> | any[]
Type subjective to flattening.
Gradual
Ƭ Gradual<T>: T extends [...(infer R), any] ? R["length"] extends 0 ? T : T | Gradual<R> : T
Gradual defines a tuple type which accepts any amount of entries from the original one.
Gradual<[1, 2, 3]> === [1] | [1, 2] | [1, 2, 3]
Type parameters
| Name | Type |
|---|---|
T | extends any[] | readonly any[] |
Last
Ƭ Last<T>: T extends [...any[], infer L] ? L : any
Picks the last entry from the tuple or array.
Type parameters
| Name | Type |
|---|---|
T | extends any[] |
Map
Ƭ Map<From, To>: (value: From) => To
Type parameters
| Name |
|---|
From |
To |
Type declaration
▸ (value): To
A type of a function which maps the original value type to another one.
Parameters
| Name | Type |
|---|---|
value | From |
Returns
To
Slice
Ƭ Slice<T, C>: T["length"] extends C ? T : T extends readonly [...Tuple<C>, ...(infer S)] ? S : T extends [...Tuple<C>, ...(infer S)] ? S : T
Removes C amount of T elements from the start.
Type parameters
| Name | Type |
|---|---|
T | extends any[] | readonly any[] |
C | extends number |
Trim
Ƭ Trim<T, C>: T["length"] extends C ? T : T extends readonly [...(infer S), ...Tuple<C>] ? S : T extends [...(infer S), ...Tuple<C>] ? S : T
Removes C amount of T elements from the end.
Type parameters
| Name | Type |
|---|---|
T | extends any[] | readonly any[] |
C | extends number |
Tuple
Ƭ Tuple<L, T>: T extends { length: L } ? T : Tuple<L, [...T, any]>
Creates a tuple of specified length.
Type parameters
| Name | Type |
|---|---|
L | extends number |
T | extends any[] | readonly any[] = [] |
UnaryFunction
Ƭ UnaryFunction: (arg: any) => any
Type declaration
▸ (arg): any
A type of a function accepting exactly one argument
Parameters
| Name | Type |
|---|---|
arg | any |
Returns
any
Unshift
Ƭ Unshift<T, I, E>: I extends 0 ? [E, ...Slice<T, 1>] : I extends Trim<T, 1>["length"] ? [...Trim<T, 1>, E] : [...Trim<T, Slice<T, I>["length"]>, E, ...Slice<Slice<T, I>, 1>]
Replaces T element on specified index I with E.
Type parameters
| Name | Type |
|---|---|
T | extends any[] | readonly any[] |
I | extends number |
E | E |
VariadicFunction
Ƭ VariadicFunction: (...args: any[]) => any
Type declaration
▸ (...args): any
A type of a function accepting an arbitrary amount of arguments
Parameters
| Name | Type |
|---|---|
...args | any[] |
Returns
any