首页 > 解决方案 > 错误 TS2583:找不到名称“地图”。您需要更改目标库吗?尝试将 `lib` 编译器选项更改为 es2015 或更高版本

问题描述

快速的答案将不胜感激。这是我的 tsconfig.json 文件

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

标签: angular

解决方案


回答这个问题为时已晚;但即使我遇到了这个问题,也可以通过在编译 TS 文件时直接将 lib 文件作为参数提供来解决。tsc --lib


推荐阅读