Skip to content

Commit

Permalink
Merge pull request #2896 from cloudflare/sidharthachatterjee/callback…
Browse files Browse the repository at this point in the history
…-last-argument

Make callback the last arg for Workflow do
  • Loading branch information
sidharthachatterjee authored Oct 10, 2024
2 parents e4a4d4d + 67832e7 commit c73705a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions types/defines/rpc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,22 @@ declare module "cloudflare:workers" {
};

export type WorkflowStep = {
do: <T extends Rpc.Serializable>(
name: string,
callback: () => Promise<T>,
config?: WorkflowStepConfig
) => Promise<T>;
do:
| (<T extends Rpc.Serializable>(
name: string,
callback: () => Promise<T>
) => Promise<T>)
| (<T extends Rpc.Serializable>(
name: string,
config: WorkflowStepConfig,
callback: () => Promise<T>
) => Promise<T>)
| (<T extends Rpc.Serializable>(
name: string,
config: WorkflowStepConfig | (() => Promise<T>),
callback?: () => Promise<T>
) => Promise<T>);

sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
};

Expand Down

0 comments on commit c73705a

Please sign in to comment.