On this page
  1. Parameters
  2. Syntax & Overview
  3. Notes & Pitfalls
  4. Example

Parameters

Prev: `ReturnType` | Up: function_and_promise | Next: `Awaited`
Rel: function_and_promise, Conditional & Mapped Types
Ref: TypeScript Docs — Utility Types
Tags: #public #web #typescript #utility-types #function_and_promise #tier/core


Syntax & Overview

Parameters<Fn>

Extracts the parameter list of a function type Fn as a tuple.

Notes & Pitfalls

Example

function createUser(name: string, admin: boolean) {
  return { name, admin };
}

type CreateArgs = Parameters<typeof createUser>; // [name: string, admin: boolean]
const call = (...args: CreateArgs) => createUser(...args);

Linked from

Related notes