devtypes - v1.1.0
    Preparing search index...

    Type Alias Compose<F, G>

    Compose: Parameters<G>[0] extends ReturnType<F>
        ? (arg: Parameters<F>[0]) => ReturnType<G>
        : never

    Compose two functions.

    Type Parameters

    • F extends (arg: any) => any

      First function type

    • G extends (arg: any) => any

      Second function type

    Creates a new function that applies F then G with proper type chaining. If types mismatch, the result is never.

    type F = ( x: number ) => string;
    type G = ( y: string ) => boolean;
    type Composed = Compose< F, G >;
    // ( arg: number ) => boolean