-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
@types/chrome
needs to be installed manually when using pnpm
#1116
Comments
Is the Although you are still experiencing differences in behavior due to the package manager? |
as per #784 (comment), it seems to need to install when |
@2wheeh Alright, there are two problems. I understood it too. First, for some reason in the Here's the code inside. wxt/packages/wxt/src/browser/chrome.ts Line 12 in 68183b6
The second thing is that the interface as a type cannot be inferred from the The workaround over here is below, and either approach should be used. import { Runtime } from "wxt/browser";
// This types from webextension-polyfill
function handler1(params: Runtime.MessageSender) {}
// This types from @types/chrome(need install `@types/chrome`)
function handler2(params: chrome.runtime.MessageSender) {} |
@1natsu172 thank you for the very clear summary 👍🏻 |
Describe the bug
when using npm, TS infers browser namespace successfully:
but when using pnpm, it fails without installing
@types/chrome
manually:we may need to improve docs or fix: this might be related to how pnpm handles devDependencies differently from npm.
Reproduction
just start fresh projects with pnpm following installation docs.
Steps to reproduce
after installing, put your cursor on
browser.runtime.*
to see the inferred types.for example,
browser.runtime.id
inentrypoints/background.ts
.System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: