Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/channel/custom/index.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.2.0/channel/custom/index.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