TypeScript Utility Types

ThisParameterType<T> — extract an explicit receiver

ThisParameterType extracts the declared TypeScript this parameter of a function type. When no explicit receiver can be extracted, the result is unknown. It does not discover which object will actually call a function. The this parameter is erased from emitted JavaScript and is not counted among ordinary positional arguments. Example output: "Ready!". Verified with strict TypeScript 5.8.3, ES2022 and Node.js 22.16.0. This utility affects static typing; no runtime validation or transformation is supplied by the type itself.

Formal Syntax & Structure

typescript syntaxtypescript
ThisParameterType<T>

Parameters & Attributes

NameTypeDescription
Ttype parameterFunction type to examine for an explicit this parameter.

Working Example

Example Snippettypescript
function show(this: { label: string }, suffix: string) { return this.label + suffix; }const receiver: ThisParameterType<typeof show> = { label: "Ready" };console.log(show.call(receiver, "!"));
TypeScript Reference