diff --git a/packages/restate-sdk/src/common_api.ts b/packages/restate-sdk/src/common_api.ts index 0caab1b0..306a9e31 100644 --- a/packages/restate-sdk/src/common_api.ts +++ b/packages/restate-sdk/src/common_api.ts @@ -32,6 +32,7 @@ export type { SendClient, ClientCallOptions, ClientSendOptions, + RemoveVoidArgument, } from "./types/rpc.js"; export { service, diff --git a/packages/restate-sdk/src/types/rpc.ts b/packages/restate-sdk/src/types/rpc.ts index 689c70d7..a461ecc4 100644 --- a/packages/restate-sdk/src/types/rpc.ts +++ b/packages/restate-sdk/src/types/rpc.ts @@ -20,6 +20,8 @@ import type { InvocationPromise, ObjectContext, ObjectSharedContext, + TypedState, + UntypedState, WorkflowContext, WorkflowSharedContext, } from "../context.js"; @@ -480,13 +482,21 @@ export namespace handlers { } export namespace workflow { - export function workflow( + export function workflow< + O, + I = void, + TState extends TypedState = UntypedState + >( opts: WorkflowHandlerOpts, - fn: (ctx: WorkflowContext, input: I) => Promise + fn: (ctx: WorkflowContext, input: I) => Promise ): RemoveVoidArgument; - export function workflow( - fn: (ctx: WorkflowContext, input: I) => Promise + export function workflow< + O, + I = void, + TState extends TypedState = UntypedState + >( + fn: (ctx: WorkflowContext, input: I) => Promise ): RemoveVoidArgument; export function workflow( @@ -514,9 +524,13 @@ export namespace handlers { * @param opts additional configurations * @param fn the handler to execute */ - export function shared( + export function shared< + O, + I = void, + TState extends TypedState = UntypedState + >( opts: WorkflowHandlerOpts, - fn: (ctx: WorkflowSharedContext, input: I) => Promise + fn: (ctx: WorkflowSharedContext, input: I) => Promise ): RemoveVoidArgument; /** @@ -528,8 +542,12 @@ export namespace handlers { * @param opts additional configurations * @param fn the handler to execute */ - export function shared( - fn: (ctx: WorkflowSharedContext, input: I) => Promise + export function shared< + O, + I = void, + TState extends TypedState = UntypedState + >( + fn: (ctx: WorkflowSharedContext, input: I) => Promise ): RemoveVoidArgument; /** @@ -567,9 +585,13 @@ export namespace handlers { * @param opts additional configurations * @param fn the handler to execute */ - export function exclusive( + export function exclusive< + O, + I = void, + TState extends TypedState = UntypedState + >( opts: ObjectHandlerOpts, - fn: (ctx: ObjectContext, input: I) => Promise + fn: (ctx: ObjectContext, input: I) => Promise ): RemoveVoidArgument; /** @@ -584,8 +606,12 @@ export namespace handlers { * * @param fn the handler to execute */ - export function exclusive( - fn: (ctx: ObjectContext, input: I) => Promise + export function exclusive< + O, + I = void, + TState extends TypedState = UntypedState + >( + fn: (ctx: ObjectContext, input: I) => Promise ): RemoveVoidArgument; /** @@ -628,9 +654,13 @@ export namespace handlers { * @param opts additional configurations * @param fn the handler to execute */ - export function shared( + export function shared< + O, + I = void, + TState extends TypedState = UntypedState + >( opts: ObjectHandlerOpts, - fn: (ctx: ObjectSharedContext, input: I) => Promise + fn: (ctx: ObjectSharedContext, input: I) => Promise ): RemoveVoidArgument; /** @@ -644,8 +674,12 @@ export namespace handlers { * @param opts additional configurations * @param fn the handler to execute */ - export function shared( - fn: (ctx: ObjectSharedContext, input: I) => Promise + export function shared< + O, + I = void, + TState extends TypedState = UntypedState + >( + fn: (ctx: ObjectSharedContext, input: I) => Promise ): RemoveVoidArgument; /**