Type expression

Parameters<T>

  • Utility types
  • Since TypeScript 3.1

Parameters<typeof addToCart> is the tuple [sku: string, quantity: number, options?: { giftWrap?: boolean }]. A wrapper that logs, retries or times a call can take ...args with that type and pass them on, and every call to the wrapper is checked as if it were a call to addToCart (TS2345 for a string quantity, as the example shows).

Indexing the tuple names one parameter's type: Parameters<typeof addToCart>[2] is the options object. The handbook gives TypeScript 3.1 as the release that added Parameters.

At a glance

Use JSDoc in a .js file TypeScript in a .ts file
All parameters, as a tuple /** @param {Parameters<typeof addToCart>} args */ function f(...args) {} function f(...args: Parameters<typeof addToCart>) {}
One parameter /** @typedef {Parameters<typeof addToCart>[2]} AddOptions */ type AddOptions = Parameters<typeof addToCart>[2];

Examples

logged.js logged.ts Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: logged.js(23,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. logged.ts(16,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. logged.js(23,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. logged.ts(16,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. logged.js(23,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. logged.ts(16,21): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. checked 21 October 2026
/**
 * @param {string} sku
 * @param {number} quantity
 * @param {{ giftWrap?: boolean }} [options]
 */
export function addToCart(sku, quantity, options) {
  return { sku, quantity, giftWrap: options?.giftWrap ?? false };
}

/** @param {Parameters<typeof addToCart>} args */
export function addAndLog(...args) {
  console.info("add to cart", ...args);
  return addToCart(...args);
}

/** @typedef {Parameters<typeof addToCart>[2]} AddOptions */

/** @type {AddOptions} */
const gift = { giftWrap: true };

addAndLog("TEE-01", 2, gift);
addAndLog("TEE-01", "2");error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
export function addToCart(sku: string, quantity: number, options?: { giftWrap?: boolean }) {
  return { sku, quantity, giftWrap: options?.giftWrap ?? false };
}

export function addAndLog(...args: Parameters<typeof addToCart>) {
  console.info("add to cart", ...args);
  return addToCart(...args);
}

type AddOptions = Parameters<typeof addToCart>[2];

const gift: AddOptions = { giftWrap: true };

addAndLog("TEE-01", 2, gift);
addAndLog("TEE-01", "2");error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
Parameters<T> for a wrapper with the same arguments.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

The @param on a rest parameter

For function addAndLog(...args), the tag is @param {Parameters<typeof addToCart>} args, the whole tuple, without the three dots. With a tuple type, TypeScript knows the length and the type of each position, optional ones included.

Gotchas

  • For a function from a library, Parameters<typeof libraryFunction> follows the library's own types and stays right when it upgrades.
  • ConstructorParameters<typeof SomeClass> is the counterpart for a class's constructor.

Questions

How do I type a wrapper function's arguments in JSDoc?

Give the rest parameter the wrapped function's parameter tuple: @param {Parameters<typeof original>} args on function wrapper(...args).

Sources

Last reviewed 20 October 2026.