Skip to content

Commit

Permalink
Improve type inference for workflows defied from an interface
Browse files Browse the repository at this point in the history
with this commit it is now possible to init a workflow client
by defining an interface manually. For example:

```

type MyWorkflow = {

    run(ctx: unknown, arg: string): Promise<string>;

}

ingress.workflowClient<MyWorkflow>( { ... },
theKey).submitWorkflow("hi")

```
  • Loading branch information
igalshilman committed Sep 23, 2024
1 parent e931fd8 commit cc36e92
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/restate-sdk-core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ export type WorkflowDefinition<P extends string, M> = {
name: P;
};

export type Workflow<M> = M extends WorkflowDefinition<string, infer W>
? W
: never;
export type Workflow<M> = M extends WorkflowDefinition<string, infer W> ? W : M;

export type WorkflowDefinitionFrom<M> = M extends WorkflowDefinition<
string,
Expand Down

0 comments on commit cc36e92

Please sign in to comment.