How to install Typescript typings for google maps

前端 未结 12 1098
春和景丽
春和景丽 2020-11-28 04:07

How can it be done - I\'ve tried combinations of

typings install [googlemaps | google.maps] [--ambient] --save

and end up with variations o

12条回答
  •  爱一瞬间的悲伤
    2020-11-28 04:11

    I tested these steps on my ionic 2 project and it is works perfectly:

    1. install typings globally :

    npm install typings --global
    
    1. install google.maps via typings

    typings install dt~google.maps --global --save
    
    1. open tsconfig.json and add "typings/*.d.ts" to your "include" array as shown below (tsconfig.json).

    {
      "compilerOptions": {
        "allowSyntheticDefaultImports": true,
        "declaration": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "lib": [
          "dom",
          "es2015"
        ],
        "module": "es2015",
        "moduleResolution": "node",
        "sourceMap": true,
        "target": "es5"
      },
      "include": [
        "src/**/*.ts",
        "typings/*.d.ts"
      ],
      "exclude": [
        "node_modules"
      ],
      "compileOnSave": false,
      "atom": {
        "rewriteTsconfig": false
      }
    }
    

提交回复
热议问题