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

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

hichemfantar
Copy link
Contributor

@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: d435ec1

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 Jan 6, 2025 0:26am

Copy link
Contributor

@jacksteamdev jacksteamdev left a comment

Choose a reason for hiding this comment

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

LGTM

@jacksteamdev jacksteamdev merged commit ee860e7 into crxjs:main Jan 6, 2025
1 check was pending
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