← All Exercises
Typed Promise.all
intermediatetypescript
Background
Parallel async operations with Promise.all improve performance, and TypeScript typing ensures correct result handling.
Problem
Write a function that fetches user data and their posts in parallel using Promise.all, returning a typed combined result.
Input
A user ID number to fetch data for.
Output
A combined object with user and posts data, properly typed.
Sample tests
Sample 1
Input: userId=1
Expected: {user: {...}, posts: [...]}Your solution
Learning objective
Learn typed parallel async operations with Promise.all and tuple destructuring.