According to Mozilla docs I should be able to use browser.storage.sync.get
for my extension, but I'm having some difficulty making typescript understand that I can use browser
.
I have tried this (which works for using chrome
)
package
"@types/chrome": "^0.0.209",
"@types/firefox": "^0.0.31",
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "CommonJS",
"strict": true,
"resolveJsonModule": true,
"types": ["chrome", "firefox"]
},
"include": ["src", "scripts", "bundle.ts"],
"exclude": ["node_modules", "dist", "scripts"]
}
What am I missing?
CodePudding user response:
The global browser
variable is part of the webextension environment, typescript bindings are provided in @types/firefox-webext-browser:
npm i -D @types/firefox-webext-browser