What do ReturnType, Parameters, Awaited, and InstanceType give for this code?
Name the type each ^? line points at, and every error TypeScript reports.
interface User { id: string; name: string;} async function fetchUser(id: string, options?: { cache: boolean }): Promise<User> { return { id, name: "Ada" };} function parse(text: string): number;function parse(text: string, big: true): bigint;function parse(text: string, big?: boolean) { return big ? BigInt(text) : Number(text);} class Cache { constructor(public name: string) {}} type A = ReturnType<typeof fetchUser>;// ^?type B = Awaited<ReturnType<typeof fetchUser>>;// ^?type C = Parameters<typeof fetchUser>;// ^?type D = ReturnType<typeof parse>;// ^?type E = InstanceType<typeof Cache>;// ^?type F = ReturnType<fetchUser>;Work it out first: the compiler shows every error and type.
The answer
Work out every error TypeScript reports and every type it shows, line by line. Then check.
Checking your sign-in…