Added a type that unwraps constructor return type

This commit is contained in:
Kir_Antipov 2022-12-25 12:49:05 +00:00
parent f436b151aa
commit 2c2bcb4de7

View file

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