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

Missing types for chrome.runtime.lastError and chrome.runtime.sendMessage #19

Open
piedrahitapablo opened this issue Nov 30, 2021 · 1 comment

Comments

@piedrahitapablo
Copy link

piedrahitapablo commented Nov 30, 2021

Hi, I'm now migrating an extension to manifest v3 that was previously using @types/chrome, so far I have found 3 issues working with chrome-types:

  1. Not really sure, but I think chrome.runtime.lastError is still a thing in manifest v3 and the types do not reflect its existence
  2. For chrome.runtime.sendMessage there's a missing overload to call it only with a message and the callback, like chrome.runtime.sendMessage(message, cb)
  3. Not sure if it's something intended but the types are missing adding the chrome property to the Window interface, if so, I think there should be some docs to show that

Thanks!

@shahriar-shojib
Copy link

Hi, to add chrome types on your project, you may include it on tsconfig.json's compilerOptions like this
I agree with you on the runtime.sendMessage method missing the overloads.
I think @types/chrome has has them properly typed with Promises

{
  "compilerOptions": {
    "types": ["chrome-types"]
  }
}

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

No branches or pull requests

2 participants