Added a type that unwraps constructor parameters

This commit is contained in:
Kir_Antipov 2022-12-27 10:18:57 +00:00
parent e473e4b641
commit 1967a52df9

View file

@ -0,0 +1,6 @@
/**
* Obtains the parameters of a constructor function.
*
* @template T - The constructor function.
*/
export type ConstructorParameters<T extends new (...args: unknown[]) => unknown> = T extends new (...args: infer P) => unknown ? P : never;