TypeScript · Middle · Question 35 of 75

What does Parameters<(a: string, b?: number) => void> return?

Explanation

Parameters returns a tuple of parameters, preserving optionality and names. Handy for wrappers: function logged(...args: Parameters<typeof fn>). For constructors there's ConstructorParameters.

Further reading

Problem with a question

TypeScript · Middle · question 35

Test yourself

Take the TypeScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz