Last active
September 6, 2020 09:08
-
-
Save roalcantara/bafcc443e90f4de6f4f8f283b4b34722 to your computer and use it in GitHub Desktop.
TypeScript 3.9 | Advanced Types: Extracts generic types from a class or an interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClassInfer<I> = | |
I extends Promise<infer G> | |
? G | |
: never | |
const promise = new Promise<string>(() => {}) | |
type Type1 = ClassInfer<typeof promise> // string | |
// https://medium.com/free-code-camp/typescript-curry-ramda-types-f747e99744ab | |
// https://github.com/millsp/medium/blob/master/types-curry-ramda/src/index.ts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment