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 2 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

⚠️ No Changeset found

Latest commit: d62003b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 9, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
vite-plugin-docs ⬜️ Ignored (Inspect) Visit Preview Sep 9, 2024 0:41am

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"'
1 participant