TS-UT

func

utils

Func

type Func<A extends ROList = any[], R = any>

Creates a function type with the given arguments and return type.

Example
type F1 = Func; // () => any
type F2 = Func<[string]>; // (args_0: string) => any
type F3 = Func<[], string>; // () => string
type F4 = Func<[name: string], string>; // (name: string) => string

OrFunc

type OrFunc<T, A extends ROList = []>

An alias for T | Func<A, T>.

See Func

VoidFn

type VoidFn

An alias for () => void.

Params

type Params<F extends Func>

An alias for Parameters.

Param

type Param<F extends Func, I extends number>

Gets the parameter at the given index. Negative indices are supported.

Example
type Fn = (a: string, b: number) => void;
type R1 = Param<Fn, 0>; // string
type R2 = Param<Fn, -1>; // number

RT

type RT<F extends Func>

An alias for ReturnType.

On this page