type Unpromise<T>
Utility type to transform an object/API with potentially asynchronous calls into a synchronous one. This is used to allow RPC calls to act as though they are synchronous, but have only the resulting return type be asynchronous.
Definition
type Unpromise<T> = T extends Promise<infer R> ? Unpromise<R> : T extends (...args: infer A) => infer R ? (...args: A) => Unpromise<R> : T extends readonly any[] ? {
readonly [K in keyof T]: Unpromise<T[K]>;
} : T extends Record<any, any> ? {
readonly [K in keyof T]: Unpromise<T[K]>;
} : T;