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

Property 'OnInstalledReason' does not exist on type 'typeof runtime'.ts(2339) #77

Open
ezolcem opened this issue Jun 30, 2024 · 3 comments

Comments

@ezolcem
Copy link

ezolcem commented Jun 30, 2024

https://developer.chrome.com/docs/extensions/reference/api/runtime#example-uninstall-url

chrome.runtime.onInstalled.addListener(details => {
  if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
    chrome.runtime.setUninstallURL('https://example.com/extension-survey');
  }
});

TypeScript gives error:

Property 'OnInstalledReason' does not exist on type 'typeof runtime'.ts(2339)

@ouweiya
Copy link

ouweiya commented Sep 4, 2024

The @types/chrome type library seems to be more comprehensive.

@ad1992
Copy link

ad1992 commented Sep 11, 2024

The @types/chrome type library seems to be more comprehensive.

I agree, there are few types missing from chrome-types in addition to the above - chrome.runtime.lastError also isn't available as well, however @types/chrome works well.

@jpc-ae
Copy link

jpc-ae commented Jan 10, 2025

The current issue I have with @types/chrome is the lack of Promise overflows. It always types extension v3 calls as synchronous with callback even if I prepend an await or add a .then().catch(). In the end I decided to use chrome-types and just provide my own global types for the enums I want to reference.

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

4 participants