TypeScript · Middle · Question 35 of 75
What does Parameters<(a: string, b?: number) => void> return?
- ✓Correct answer:
[a: string, b?: number] - 2
string | number - 3
{ a: string; b?: number }
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.