Skip to content

fix: Allow passing strings instead of enums #1646

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aklinker1
Copy link
Collaborator

@aklinker1 aklinker1 commented May 2, 2025

Overview

Addresses concerns mentioned here:

Warning

Not sure if I want to actually merge this PR or not... The regex approach isn't very clean, and it makes mistakes. I think it would make more sense to update @types/chrome directly to allow using string litterals in specific cases, like they already do.

Manual Testing

See new type test

Copy link

netlify bot commented May 2, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 8b2c592
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/6814bc38d2c0ee0008879e28
😎 Deploy Preview https://deploy-preview-1646--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented May 2, 2025

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@1646

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@1646

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@1646

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@1646

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@1646

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@1646

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@1646

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@1646

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@1646

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@1646

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@1646

wxt

npm i https://pkg.pr.new/wxt@1646

commit: 8b2c592

@@ -13209,7 +13209,7 @@ export namespace Browser {
/**
* A list of request types. Requests that cannot match any of the types will be filtered out.
*/
types?: ResourceType[] | undefined;
types?: (ResourceType | `${ResourceType}`)[] | undefined;
Copy link
Collaborator Author

@aklinker1 aklinker1 May 2, 2025

Choose a reason for hiding this comment

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

Downside to this approach: ResourceType is actually a string literal union here. There's another enum further down that is named ResourceType, so this type was also modified.

This might be fine now, but as @types/chrome is updated, this approach might cause problems in the future.

@aklinker1 aklinker1 marked this pull request as ready for review May 2, 2025 12:39
@aklinker1 aklinker1 requested a review from Timeraa as a code owner May 2, 2025 12:39
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.

1 participant