mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2025-01-22 18:14:45 +01:00
Added a type that unwraps promises
This commit is contained in:
parent
6e27f6c851
commit
f436b151aa
1 changed files with 6 additions and 0 deletions
6
src/utils/types/promise-type.ts
Normal file
6
src/utils/types/promise-type.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* Obtains the underlying type of a {@link Promise}.
|
||||||
|
*
|
||||||
|
* @template T - A `Promise` type to extract the underlying type from.
|
||||||
|
*/
|
||||||
|
export type PromiseType<T extends Promise<unknown>> = T extends Promise<infer U> ? U : never;
|
Loading…
Reference in a new issue