/** * RemotePromise: the result of an RPC method call. * * A custom thenable — not a Promise subclass. `await` works directly. Generated * subtypes (e.g. `Calculator_GetOperator$Promise`) add pipelined accessors for * capability fields in the result struct, returning clients synchronously before the * call resolves via the protected `pipelineClient` primitive. * * Calls send eagerly: the Call message is on the wire before this object is returned. * `then` carries no protocol behavior — it only subscribes to the Return. Instances are * constructed with no arguments and initialized by the runtime, so generated subclasses * must not define constructor parameters. */ import type { Client } from "./client"; export interface RemotePromiseState { pipeline(index: number): Client; promise: Promise; } export declare class RemotePromise implements PromiseLike { catch(onrejected?: ((reason: unknown) => TResult | PromiseLike) | null): Promise; finally(onfinally?: (() => void) | null): Promise; /** * A pipelined client for the capability at pointer field `index` of the (not yet * received) result struct. Generated pipelined accessors delegate here. */ protected pipelineClient(index: number): Client; then(onfulfilled?: ((value: R) => TResult1 | PromiseLike) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike) | null): Promise; } /** Construct and initialize a RemotePromise (or generated subclass). Runtime use only. */ export declare function initRemotePromise>(PromiseClass: new () => A, s: RemotePromiseState): A;