🔷 TypeScript Intermediate

What is the Parameters utility type?

Why Interviewers Ask This

This question targets practical, hands-on experience with TypeScript. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.

Answer

Parameters<T> is a built-in utility type that extracts the parameter types of a function type T as a tuple. Implementation: type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never. Example: function createUser(name: string, age: number, admin: boolean): User { ... } type CreateUserArgs = Parameters<typeof createUser>;CreateUserArgs is [name: string, age: number, admin: boolean]. Useful for: wrapper functions that need the same parameters as another function, currying helpers, memoization wrappers. Access individual parameters: type FirstArg = Parameters<typeof createUser>[0]; — gives string. Related: ConstructorParameters<T> does the same for class constructor parameters, returning the types as a tuple. These types help you stay DRY — define parameter types once in the function and derive them everywhere else.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.