Skip to content

Commit

Permalink
fix: WorkflowHandle.signal() can take a string, default args to [] (#297
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bergundy authored Oct 13, 2021
1 parent da59776 commit f345ef9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/workflow-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ export interface WorkflowHandle<T extends Workflow> extends BaseWorkflowHandle<T
* await handle.query<number, []>('getValue');
* ```
*/
query<Ret, Args extends any[]>(def: QueryDefinition<Ret, Args> | string, ...args: Args): Promise<Ret>;
query<Ret, Args extends any[] = []>(def: QueryDefinition<Ret, Args> | string, ...args: Args): Promise<Ret>;

/**
* Sends a signal to a running Workflow or starts a new one if not already running and immediately signals it.
* Useful when you're unsure of the Workflows' run state.
*
* @returns the runId of the Workflow
*/
signalWithStart<Args extends any[]>(
signalWithStart<Args extends any[] = []>(
def: SignalDefinition<Args> | string,
signalArgs: Args,
workflowArgs: Parameters<T>
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/workflow-handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface BaseWorkflowHandle<T extends Workflow> {
* await handle.signal(incrementSignal, 3);
* ```
*/
signal<Args extends any[]>(def: SignalDefinition<Args>, ...args: Args): Promise<void>;
signal<Args extends any[] = []>(def: SignalDefinition<Args> | string, ...args: Args): Promise<void>;

/**
* The workflowId of the current Workflow
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow/src/workflow-handle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ExternalWorkflowHandle {
* await handle.signal(incrementSignal, 3);
* ```
*/
signal<Args extends any[]>(def: SignalDefinition<Args> | string, ...args: Args): Promise<void>;
signal<Args extends any[] = []>(def: SignalDefinition<Args> | string, ...args: Args): Promise<void>;

/**
* Cancel the external Workflow execution.
Expand Down

0 comments on commit f345ef9

Please sign in to comment.