Deriving Types From Values 15 exercises

Unwrap Promises with the Awaited Type Helper

The Awaited type helper can be used to unwrap promises. Combined with the ReturnType type helper, we can unwrap return types from async functions all at once:

type User = Awaited<ReturnType<typeof fetchUser>>;

Alternatively, we could create an intermediate type to show each s

Loading solution