devtypes - v1.1.0
    Preparing search index...

    Type Alias ThisParameterType<F>

    ThisParameterType: F extends (this: infer T, ...args: any[]) => any
        ? T
        : unknown

    Get the this binding type from a function.

    Type Parameters

    • F extends Function

      Function type

    1.1.0

    Extracts the this context type if present, or unknown if absent.

    type Fn = ( this: { x: number }, y: string ) => void;
    type ThisType = ThisParameterType< Fn >; // { x: number }