1
  1. TypeScript 编译中缺少使用 AGM Spidefier 库 \node_modules\agm-spiderfier\index.ts 编译代码时出现错误。请通过 'files' 或 'include' 属性确保它在您的 tsconfig 中。

  2. 下面是我的 tsconfig.app.json 和 tsconfig.spec.json

tsconfig.app.json

      {
         "extends": "./tsconfig.base.json",
         "compilerOptions": {
          "outDir": "./out-tsc/app",
           "types": []
        },
      "files": [
        "src/main.ts",
        "src/polyfills.ts"
      ],
      "include": [
        "src/**/*.d.ts",
        "../node_modules/agm-spiderfier/*.ts"
      ]
    }

tsconfig.spec.json

    {
      "extends": "./tsconfig.base.json",
      "compilerOptions": {
        "outDir": "./out-tsc/spec",
        "types": [
          "jasmine",
          "googlemaps"  
        ]
      },
      "files": [
        "src/test.ts",
        "src/polyfills.ts",
        "../node_modules/agm-spiderfier/index.ts",    
      ],
      "include": [
        "src/**/*.spec.ts",
        "src/**/*.d.ts",
        "../node_modules/agm-spiderfier/*.ts"
      ]
    }
4

1 回答 1

0
    Please modify your both the files as below.
    
    tsconfig.app.json
    
    "include": [
        "src/**/*.d.ts",
        "node_modules/agm-spiderfier/**/*.ts"
      ]
    

tsconfig.spec.json
    
     "include": [
        "src/**/*.spec.ts",
        "src/**/*.d.ts",
        "node_modules/agm-spiderfier/**/*.ts"
      ]
于 2020-11-02T16:11:08.767 回答