C.W.K.
Stream
Quiz · 3 questions

Async & Promises — Typed Concurrency

Promise<T>, async/await, async iterables, Promise.all, error handling

Level 0Curious
0 XP0/93 lessons0/23 achievements
0/100 XP to next level100 XP to go0% complete

Quiz

01What's the return type of async function foo(): string?
Hint
Hover an async function with no annotated return type — TS will infer Promise<T> based on what you return.
02What does Promise.all([p1, p2]) return at the type level?
Hint
Destructure: const [a, b] = await Promise.all([fetchA(), fetchB()]). a and b have distinct, correctly-inferred types.
03What's the type of e in try { ... } catch (e) { ... }?
Hint
Try throw 'oops' in one branch and throw new Error('oops') in another. Both reach catch, but e could be either.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.