UNPKG

rambda

Version:

Lightweight faster alternative to Ramda

21 lines (19 loc) 436 B
import {Function} from './Function' /** Extract the return type of a **`Function`** * @param F to extract from * @returns **`any`** * @example * ```ts * import {F} from 'ts-toolbelt' * * const fn = () => true * * type test0 = F.ReturnOf<typeof fn> // boolean * * type test1 = F.ReturnOf<() => true> // true * ``` */ export type Return<F extends Function> = F extends ((...args: any[]) => infer R) ? R : never