From 1967a52df9915360695afa6cf2cc5270d2abc09e Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 27 Dec 2022 10:18:57 +0000 Subject: [PATCH] Added a type that unwraps constructor parameters --- src/utils/types/constructor-parameters.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/utils/types/constructor-parameters.ts diff --git a/src/utils/types/constructor-parameters.ts b/src/utils/types/constructor-parameters.ts new file mode 100644 index 0000000..e56fab0 --- /dev/null +++ b/src/utils/types/constructor-parameters.ts @@ -0,0 +1,6 @@ +/** + * Obtains the parameters of a constructor function. + * + * @template T - The constructor function. + */ +export type ConstructorParameters unknown> = T extends new (...args: infer P) => unknown ? P : never;