Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/tsafe/UnpackPromise.ts

🔩 The missing TypeScript utils
Go to Latest
File
/** * Use case: * declare const pr: Promise<string[]>; * const x: UnpackPromise<typeof pr>; <== x is string[] */export type UnpackPromise<T extends PromiseLike<unknown> | undefined | null | false | ""> = T extends PromiseLike<infer U> ? U : never;