Skip to content

refactor(openworkflow, cli): narrow isWorkflow to a type predicate#468

Merged
jamescmartinez merged 1 commit intomainfrom
isworkflow-type-predicate
Apr 16, 2026
Merged

refactor(openworkflow, cli): narrow isWorkflow to a type predicate#468
jamescmartinez merged 1 commit intomainfrom
isworkflow-type-predicate

Conversation

@jamescmartinez
Copy link
Copy Markdown
Contributor

No description provided.

typing `isWorkflow` as `value is Workflow<unknown, unknown, unknown>` lets
callers drop the redundant `as Workflow<...>` cast in the CLI's workflow
discovery loop. no behavior change.
Copilot AI review requested due to automatic review settings April 16, 2026 21:37
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/cli@468
npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/dashboard@468
npm i https://pkg.pr.new/openworkflowdev/openworkflow@468

commit: 2bafa73

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the isWorkflow helper in OpenWorkflow’s core to be a proper TypeScript type guard, allowing downstream code (notably the CLI workflow discovery/import logic) to rely on narrowing instead of explicit casts.

Changes:

  • Updated isWorkflow to return a TypeScript type predicate (value is Workflow<unknown, unknown, unknown>).
  • Simplified CLI workflow import logic by removing an unnecessary cast and using the narrowed value directly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/openworkflow/core/workflow-definition.ts Changes isWorkflow signature to a type predicate for correct narrowing.
packages/cli/commands.ts Removes redundant cast when collecting workflows after isWorkflow check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jamescmartinez jamescmartinez merged commit efb693c into main Apr 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants