Interview Q&A / TypeScript

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What does the Parameters utility type do?

SHORT ANSWER

Parameters<typeof fn> returns the parameter types of a function as a tuple, for example [string, number]. You can index it, like Parameters<typeof fn>[0], to get one argument's type, which helps when wrapping functions.

Explain it simply

A function's argument list is a small fixed-length group, so TypeScript represents it as a tuple. Parameters hands you that tuple.

This is handy when writing a wrapper, such as a function that logs and then calls another one. Instead of copying the argument types, you derive them, so the wrapper stays correct if the original changes.

Example

ts
function book(train: string, seats: number, tatkal: boolean) {
  return `${train}:${seats}:${tatkal}`;
}

type BookArgs = Parameters<typeof book>;
// [train: string, seats: number, tatkal: boolean]

type FirstArg = Parameters<typeof book>[0];   // string

function withLog<F extends (...args: any[]) => any>(fn: F) {
  return (...args: Parameters<F>): ReturnType<F> => {
    console.log("calling with", args);
    return fn(...args);
  };
}
const loggedBook = withLog(book);
loggedBook("12951", 2, false);               // arguments are type-checked

What to say in the interview

"Parameters<F> gives a function's argument types as a tuple. I use it in wrappers and decorators together with ReturnType so the wrapper has exactly the original signature without copying it by hand."

#utility-types#functions#tuples

Related questions

Practise more TypeScript questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open TypeScript quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.