-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: widen multi-env vars
types in wrangler types
#5086
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: df55b66 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-wrangler-5086 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5086/npm-package-wrangler-5086 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-wrangler-5086 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-create-cloudflare-5086 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-cloudflare-kv-asset-handler-5086 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-miniflare-5086 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-cloudflare-pages-shared-5086 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8032131415/npm-package-cloudflare-vitest-pool-workers-5086 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5086 +/- ##
==========================================
+ Coverage 70.33% 70.42% +0.08%
==========================================
Files 298 298
Lines 15515 15536 +21
Branches 3987 3990 +3
==========================================
+ Hits 10913 10941 +28
+ Misses 4602 4595 -7
|
I've converted this PR to draft as it's been decided by the team that we should go with generic |
Hi 👋, Thanks @dario-piotrowicz for the PR, this is something we had to fix manually after running |
I'd be keen to know what the reasoning was for using a generic string type instead of string literals. Surely having more robust types would benefit those of us using typescript? My solution atm is to override the type. |
@dario-piotrowicz Is there a place to track that decision/implementation? I'd also prefer a union but I'm mostly looking to avoid this bug |
Hi @jfsiii 👋 Sorry, honestly this has fallen off my radar and I haven't pushed for a resolution, it's been quite a long time since this PR has been opened... let me ping the team and prompt them to make a decision, then I can update and merge this PR 🙂👍 |
Fixes #5082
What this PR solves / how to test:
Currently types for variable generate string literal, those are appropriate when
a single environment has been specified in the config file but if multiple environments
are specified this however wrongly restricts the typing, the changes here fix such
incorrect behavior.
For example, given a
wrangler.toml
containing the following:running
wrangler types
would generate:making typescript incorrectly assume that
MY_VAR
is always going to be"dev value"
after these changes, the generated interface would instead be:
Author has addressed the following:
Note for PR author:
We want to celebrate and highlight awesome PR review! If you think this PR received a particularly high-caliber review, please assign it the label
highlight pr review
so future reviewers can take inspiration and learn from it.