Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TypeScript toolset
type PromiseType<T> = T extends Promise<infer U> ? U : T
// const myPromise = new Promise<string>(() => {})
// type MyPromiseType = PromiseType<typeof myPromise> // string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment