function-types

OmitThisParameter<T>

Returns a function type identical to T but without its explicit `this` parameter. Commonly paired with `Function.prototype.bind` to model the bound function's signature.

type OmitThisParameter<T> = unknown extends ThisParameterType<T> ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T

Usage patterns

Pattern Purpose
OmitThisParameter<typeof fn> Get the shape of the function after binding this
fn.bind(x) Runtime operation whose type is modeled by this utility
ThisParameterType<T> Read side companion — inspect vs remove
Parameters<OmitThisParameter<T>> Get only the real args, minus this

Examples

function toHex(this: number) { return this.toString(16); }
type Bound = OmitThisParameter<typeof toHex>;

Result: () => string — this parameter removed

const bound: OmitThisParameter<typeof toHex> = toHex.bind(255);

Type mirrors the runtime .bind call

function plain(x: number) { return x; }
type Same = OmitThisParameter<typeof plain>;

Result: (x: number) => number — no-op when this is not declared

type Args = Parameters<OmitThisParameter<(this: Foo, a: 1) => 2>>;

Result: [a: 1] — the this slot is gone

Gotcha

If the function has no explicit `this` parameter, T is returned unchanged. It only removes `this` — regular parameters and return type are preserved as-is.

Related utility types

← All TS utility types · TypeScript vs JavaScript · any vs unknown vs never