Using chrome extension apis in typescript

前端 未结 5 1554
广开言路
广开言路 2021-01-30 09:17

I\'m building a chrome extension written in TypeScript. I\'m using WebStorm and I added the chrome-DefiniteltyTyped library in my project.

However, when I w

5条回答
  •  借酒劲吻你
    2021-01-30 09:59

    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"
        ]
    

提交回复
热议问题