function-types

Parameters<T>

Extracts the parameters of a function type T as a tuple. Enables reusing a function's argument list for wrappers, currying, or higher-order utilities.

type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never

Usage patterns

Pattern Purpose
Parameters<typeof fn> Reuse a function's arg list from its value
Parameters<T>[0] Get a single parameter by index
...args: Parameters<T> Spread into a wrapper function signature
ConstructorParameters<T> Class-constructor equivalent

Examples

function add(a: number, b: number) { return a + b; }
type A = Parameters<typeof add>;

Result: [a: number, b: number]

function wrap<T extends (...a: any) => any>(fn: T) {
  return (...args: Parameters<T>) => fn(...args);
}

Generic wrapper that preserves the original signature

type Second = Parameters<(x: string, y: boolean) => void>[1];

Result: boolean

type P = Parameters<() => void>;

Result: [] — empty tuple for zero-arg functions

Gotcha

Returns a tuple with parameter names as labels — those labels are cosmetic and can be dropped by later transforms. As with ReturnType, only the last overload signature is captured.

Related utility types

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