Using chrome extension apis in typescript Using chrome extension apis in typescript google-chrome google-chrome

Using chrome extension apis in typescript


As of typescript 2 (or 2.x, not sure), you should import the chrome types from @types.

in package.json:

"devDependencies": {    ...    "@types/chrome": "0.0.35", // or just npm install --save-dev @types/chrome

And in tsconfig:

    "types": [        //(various types, e.g. jquery, core-js),        "chrome"    ]


You just need to install Type definition to make it work, let's install it:

yarn add @types/chrome --dev

or NPM

npm install @types/chrome --save-dev

now use free of error!