Skip to content
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 background.type manifest property typescript type #916

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

Conversation

hichemfantar
Copy link

@hichemfantar hichemfantar commented Sep 9, 2024

this fixes the issue using the manifest.json schema instead of the config file https://json.schemastore.org/chrome-manifest.json
image

The issue arises because the schema you're trying to convert indicates that the type is a string but only allows a specific value ("module"). If you're using this TypeScript type for something that can be either a specific string or a more general string type, you may want to handle it differently.

If you want IntelliSense to work and ensure that "module" is a valid and suggested value, while still allowing other strings, you can use string literal unions in a way that provides IntelliSense but also accepts any string.
Using a branded type approach (to enforce "module" while still allowing any string but guiding IntelliSense):
type Type = "module" | (string & {});

closes #914

Copy link

changeset-bot bot commented Sep 9, 2024

🦋 Changeset detected

Latest commit: 1b296a2

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

This PR includes changesets to release 1 package
Name Type
@crxjs/vite-plugin Patch

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

Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vite-plugin-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 27, 2024 1:21am

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.

manifest type error: Type 'string' is not assignable to type '"module"'
2 participants