Skip to content
1 min read · 118 words

Function: method()

ts
function method<A, R>(opts?: MethodOptions): MethodDescriptor<A, R>;

Defined in: src/batteries/isolation/types.ts:108

Declare a request/response method on an isolated service's spec — the host gets a (...args) => Promise<R> facade method; the guest implementation returns (or resolves to) R directly (or throws/rejects, crossing back as a rejected promise on the host).

Type Parameters

Type ParameterDescription
A extends unknown[]The method's argument tuple, e.g. [MyArgs] or [string, number].
RThe method's resolved result type.

Parameters

ParameterTypeDescription
optsMethodOptionsSee MethodOptions. opts.signal opts this method into abort-signal plumbing.

Returns

MethodDescriptor<A, R>