Functions
ConstructorParameters
Extracts a constructor’s parameter list as a tuple.
What it is
The constructor counterpart to `Parameters`. It matches a `new` signature, infers the tuple between its parentheses, and preserves parameter labels and optionality. It is useful when a factory or registry must accept exactly the arguments of the class it stores.
Examples
ConstructorParameters<typeof Job>→[id: number, name: string]ConstructorParameters<abstract new (enabled: boolean) => object>
→[enabled: boolean]ConstructorParameters<any>→unknown[]`any` cannot provide a specific constructor signature, so the safe parameter tuple is `unknown[]`.
Each resolved type above was printed by TypeScript 6.0.3, not written by hand.
What it does not do
- It accepts the constructor value type, usually `typeof C`, not the instance type `C`. Those are the two sides of a class name.
- For overloaded constructors it observes the last signature, not a union of every overload, following the same rule as `Parameters`.
Takeaway
Use `typeof C` to name a class constructor, then `ConstructorParameters` to recover what goes inside `new C(...)`.
