fix(workflow): improve typing for state parameter#1124
fix(workflow): improve typing for state parameter#1124Rootlogger wants to merge 2 commits intoVoltAgent:mainfrom
Conversation
Replace DangerouslyAllowAny with unknown in WorkflowState and WorkflowStepState types to provide stricter type checking for workflow state parameter in execute handlers. This addresses issue VoltAgent#645 where state was typed as 'any' making it difficult to debug workflow execution code. Closes VoltAgent#645
🦋 Changeset detectedLatest commit: 0efe879 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request improves type safety for the workflow state parameter by replacing Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the review! No actionable changes from CodeRabbit — let me know if there's anything else I can help with. Happy to adjust if needed. 🙏 |
Summary
Replace
DangerouslyAllowAnywithunknowninWorkflowStateandWorkflowStepStatetypes to provide stricter type checking for workflow state parameter in execute handlers.Changes
packages/core/src/workflow/internal/state.ts: Changeddata: DangerouslyAllowAnytodata: unknownpackages/core/src/workflow/types.ts: ChangedWorkflowState<INPUT, DangerouslyAllowAny>toWorkflowState<INPUT, unknown>Motivation
This addresses issue #645 where
statewas typed asanymaking it difficult to debug workflow execution code. Usingunknownprovides better type safety while maintaining compatibility with existing code.Testing
The change is purely TypeScript type-level and does not affect runtime behavior.
Closes #645
Summary by cubic
Tightens typing of workflow state by replacing DangerouslyAllowAny with unknown in WorkflowState and WorkflowStepState to improve type safety of the state parameter in execute handlers; adds a changeset. Addresses #645 with no runtime impact.
Written for commit 0efe879. Summary will update on new commits.
Summary by CodeRabbit