Skip to content

wrangler types --check fails with Invalid value: true#13695

Merged
edmundhung merged 3 commits intocloudflare:mainfrom
alexanderniebuhr:fix-types-check
Apr 28, 2026
Merged

wrangler types --check fails with Invalid value: true#13695
edmundhung merged 3 commits intocloudflare:mainfrom
alexanderniebuhr:fix-types-check

Conversation

@alexanderniebuhr
Copy link
Copy Markdown
Contributor

@alexanderniebuhr alexanderniebuhr commented Apr 26, 2026

Fixes #13694

Root cause

wrangler 4.85.0 introduced a --check flag that reads back the command stored in the worker-configuration.d.ts header comment (e.g. wrangler types --include-runtime --include-env --strict-vars) and re-parses it with yargs to reconstruct the original arguments.

The problem: yargs parses --include-runtime, --include-env, and --strict-vars as native boolean true, but unsafeParseBooleanString — the internal helper used to interpret those values — only handles string inputs. Passing a boolean throws ParseError: Invalid value: true.

Fix

Add an early boolean passthrough in unsafeParseBooleanString:

if (typeof value === "boolean") {
  return value;
}

This is a minimal, non-breaking fix that handles the case where yargs already coerced the flag value to a boolean, which is the correct yargs behavior for boolean flags.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: a boolean should be a boolean
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 26, 2026

🦋 Changeset detected

Latest commit: bbcf6cc

The changes in this PR will be included in the next version bump.

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Apr 26, 2026
@workers-devprod workers-devprod requested review from a team and edmundhung and removed request for a team April 26, 2026 19:41
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Apr 26, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 26, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13695

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13695

miniflare

npm i https://pkg.pr.new/miniflare@13695

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13695

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13695

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13695

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13695

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13695

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@13695

wrangler

npm i https://pkg.pr.new/wrangler@13695

commit: bbcf6cc

@edmundhung
Copy link
Copy Markdown
Member

Thanks for the fix, @alexanderniebuhr! The solution looks good to me. Could you add a regression test in packages/wrangler/e2e/types.test.ts and a patch changeset?

@alexanderniebuhr
Copy link
Copy Markdown
Contributor Author

I hope the regression test and changeset are good enough, please feel free to adapt them if needed.

Copy link
Copy Markdown
Contributor

@workers-devprod workers-devprod left a comment

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Apr 28, 2026
@edmundhung edmundhung merged commit 92bb8a5 into cloudflare:main Apr 28, 2026
77 of 82 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Apr 28, 2026
@edmundhung
Copy link
Copy Markdown
Member

Thanks for the fix, @alexanderniebuhr! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

wrangler types --check fails with Invalid value: true

4 participants