Let's say I have a function like such:
async function f() { return 1 } // returns Promise<number>
I can get the type it returns via $Call:
type ReturnType = $Call<typeof f> // type is Promise<number>
but how can I get the resolved type of the Promise? In this case it is number.
+1
+1
You can use a helper type like this:
type UnwrapPromise<T> = $Call<<T>(Promise<T>) => T, T>;
Most helpful comment
You can use a helper type like this: