Skip to main content
Module

x/rimbu/channel/mod.ts>RpcProxy.Unpromise

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
type alias RpcProxy.Unpromise
import { type RpcProxy } from "https://deno.land/x/rimbu@1.0.2/channel/mod.ts";
const { Unpromise } = RpcProxy;

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: 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