I just upgraded to v1 and I'm getting some type errors and some of them are confusing as they don't align with the docs. I was on beta already so I didn't expect the upgrade to have much of an impact
Further details:
1. I see that the type signature of bail changed from bail(result: any): any; to bail: (result: TStepOutput) => InnerOutput; I was using bail to early return/early stop my workflow execution so I think having TStepOutput as the type of the result doesn't make much sense This is also not in line with that's in the docs https://mastra.ai/docs/workflows/human-in-the-loop#handling-human-rejection-with-bail Using would give a type error now unless your output schema would be
reason: z.string()
reason: z.string()
return bail({ reason: "User rejected the request." })
return bail({ reason: "User rejected the request." })
2. When starting a workflow with
runAsync()
runAsync()
the type of
inputData
inputData
is not inferred correctly. I have two workflows, one is just the weather workflow from the examples and the other one is my own order intake workflow When using the following:
Type '{ data: string; }' is not assignable to type '{ city: string; } & { data: string; }'.Property 'city' is missing in type '{ data: string; }' but required in type '{ city: string; }'.ts(2322)
Type '{ data: string; }' is not assignable to type '{ city: string; } & { data: string; }'.Property 'city' is missing in type '{ data: string; }' but required in type '{ city: string; }'.ts(2322)
So instead of inferring the correct input type for my workflow, it expects me to pass in the input type of BOTH the order intake workflow and the weather workflow