Typescript 3.0.1编译器选项typeRoots无法识别

Typescript 3.0.1编译器选项typeRoots无法识别,typescript,Typescript,我正在尝试编译一个基本项目,并在我的库中包含lodash。根据Typescript 3.0文档,这应该是可行的 package.json { ... "dependencies": { "lodash": "4.17.10", "npm-run-all": "4.1.2", "typescript": "3.0.1" } ... } tsconfig.json { "compileOnSave": false, "compilerOptions": {

我正在尝试编译一个基本项目,并在我的库中包含lodash。根据Typescript 3.0文档,这应该是可行的

package.json

{ 
 ...
 "dependencies": {
   "lodash": "4.17.10",
   "npm-run-all": "4.1.2",
   "typescript": "3.0.1"
  }
 ...
}
tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitAny": false,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true,
    "outDir": "./dist/out-tsc",
    "typeRoots": [
      "./node_modules/@types/"
    ]
  },
  "include": [
    "src/**/*.ts",
    "node_modules/@types"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts"
  ]
}
类型也会发生同样的情况。根据谷歌搜索,我的组件需要
typeroot
types
才能包含
lodash
。我遗漏了什么?

我的答案:

{
“编译器选项”:{
“严格”:是的,
“模块”:“commonjs”,
“目标”:“ESNext”,
“noImplicitAny”:没错,
“类型根”:[“app/types/*”、“/node_modules/@types”、“../../node_modules/@types”、],
“类型”:[“节点”,“笑话”],
“moduleResolution”:“节点”,
“baseUrl”:“/”,
“sourceMap”:false,
“esModuleInterop”:正确,
“实验生态学者”:没错,
“ForceConsistentCasingFileNames”:true,
“strictPropertyInitialization”:false,
“outDir”:“构建”
},
“包括“:[”/app/***“],
“排除”:[“节点\模块”、“/\测试\测试\测试/*”]
}

2.7.2运行良好您是否尝试删除
typeroot
并仅包括
“类型”:[“节点”,“lodash”]
?是,“类型”导致相同的错误您是否安装了
@types/lodash
软件包?它必须与
lodash
分开安装。