wxt-dev / wxt

⚡ Next-gen Web Extension Framework
https://wxt.dev
MIT License
4.16k stars 171 forks source link

Improve typing of `manifest` config #521

Closed aklinker1 closed 1 month ago

aklinker1 commented 7 months ago

Feature Request

Instead of using webextension-polyfill's Manifest.WebExtensionManifest type, implement our own that works for both Chrome and firefox, as well as MV2 and MV3.

Is your feature request related to a bug?

N/A

What are the alternatives?

TS ignoring things everywhere.

Additional context

Realized the types weren't good enough in #518

pavitra-infocusp commented 7 months ago

Missing manifest.key property type on wxt.config.ts. It works though.

Object literal may only specify known properties, and 'key' does not exist in type 'Partial<Omit<WebExtensionManifest, "background" | "chrome_url_overrides" | "devtools_page" | "manifest_version" | "options_page" | "options_ui" | "sandbox">> | Promise<...> | UserManifestFn'.ts(2353)
index-l43sonfW.d.ts(227, 5): The expected type comes from property 'manifest' which is declared here on type 'UserConfig'
(property) key: string
trinhcanhphuc commented 7 months ago

any solution for this issue ? :(

aklinker1 commented 7 months ago

Writing 1000 lines of types takes time. Its a WIP

Just use // @ts-expect-error

aklinker1 commented 1 month ago

Update, after adding support for @types/chrome via extensionApi: "chrome" (see #868), I'm planning on migrating the manifest type to @types/chrome as well. Need to review it's types to see how well it supports Firefox-only fields.

aklinker1 commented 1 month ago

Released in v0.19.9