All challenges
Unwrap a Promise with Conditional Types
hardadvanced-types200 XPProblem
Implement UnwrapPromise<T>: a conditional type that extracts U from Promise<U>, and leaves non-promise types unchanged (UnwrapPromise<string> is just string). Use the infer keyword. Then use it to type values derived from an async function's return type.
Expected output
50
plainHints
Stuck? Reveal hints one at a time.
Solution
Try solving it yourself first — revealing is always available.
Press Run in the editor — your console output is checked automatically.
No errors
Loading...
Console output appears here. Press Run or just type — the code compiles automatically.