Property 'OnInstalledReason' does not exist on type 'typeof runtime'.ts(2339)
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)
The @types/chrome type library seems to be more comprehensive.
The
@types/chrometype 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.
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.