Question about Awaited type #12837
-
I was wondering why nobody submitted this solution, what is wrong ? Thanks !
|
Beta Was this translation helpful? Give feedback.
Answered by
JonghwanWon
Jul 9, 2022
Replies: 1 comment
-
The solution you submitted does not solve Promise of recursive case. type ExampleType = Promise<Promise<string>> // nested promises.
type MyAwaited<T extends Promise<any>> = T extends Promise<infer R>
? R
: never;
type Result = MyAwaited<ExampleType> // Promise<string> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Dovakeidy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The solution you submitted does not solve Promise of recursive case.