ConstructorParameters<T>
The utility type that gives a class constructor's parameter list as a tuple.
In more detail
Factories and dependency injection containers use it to check that they pass a class the right arguments. InstanceType gives the type of object that class creates.
Related terms
- InstanceType<T> — The utility type that gives the type of object produced by calling new on class type T.
- constructor — The special method that runs when a new object is created from a class and sets up its starting data.
- dependency injection — Giving an object the collaborators it needs from outside, usually through its constructor, instead of letting it create or look them up itself.
- factory function — A function whose job is to create and return new objects, often choosing or configuring the class to use.
Taught in
- Union Utilities: Exclude, Extract, NonNullable And Awaited — Production TypeScript
- Function Utilities: ReturnType, Parameters And Constructor — Production TypeScript