【发布时间】:2019-01-09 02:07:29
【问题描述】:
我正在使用 tsc 构建任务。不幸的是,我总是从节点模块文件夹中得到相同的错误
Executing task: .\node_modules\.bin\tsc.cmd --watch -p .\tsconfig.json <
node_modules/@types/node/index.d.ts(6208,55): error TS2304: Cannot find name 'Map'.
node_modules/@types/node/index.d.ts(6215,55): error TS2304: Cannot find name 'Set'.
node_modules/@types/node/index.d.ts(6219,64): error TS2304: Cannot find name 'Symbol'.
node_modules/@types/node/index.d.ts(6225,59): error TS2304: Cannot find name 'WeakMap'.
node_modules/@types/node/index.d.ts(6226,59): error TS2304: Cannot find name 'WeakSet'.
10:13:18 - Compilation complete. Watching for file changes.
我已经将目录添加到tsconfig.json的忽略
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"strict": false,
"noImplicitAny": false,
"strictPropertyInitialization": false,
"esModuleInterop": true,
},
"include": [
"src/*"
],
"exclude": [
"node_modules",
"./node_modules",
"./node_modules/*",
"./node_modules/@types/node/index.d.ts",
]
}
我做错了什么?我应该怎么做才能忽略这些错误?
我正在使用 VsCode 和 tsc 版本 2.9.2
【问题讨论】:
-
这可能会有所帮助:"...为此,编译器需要一个模块的定义,这可以是您自己的代码的 .ts 文件,也可以是 .d。 ts 用于导入的定义文件。如果找到该文件,则无论在前面的步骤中是否排除它,都将包含该文件。" -> github.com/Microsoft/TypeScript/wiki/…
-
我想要类型。我不想构建我的项目。为此,我使用 JSDoc,因为它使用跑步者会忽略的 cmets。我能找到的唯一可以针对 JSDoc 对我的类型进行 lint 的 CLI 是带有“noEmit”的 Typescript CLI:true 和“checkJs”:true。但后来我从 node_modules/utils/utils.js 得到错误。我不想要这些错误。我怎样才能删除它们?
标签: node.js typescript tsc tsconfig