@types/node/index.d.ts(6208,55): error TS2304: 找不到名称'Map' 'Set' 'Symbol' 'WeakMap' 'WeakSet'。

3

我一直遇到这些错误。我已经将lib和target设置为“ES2018”,但仍然不起作用。这是我的tsconfig.json文件:

{
   "compilerOptions": {
       "module": "commonjs",
       "noImplicitAny": true,
       "removeComments": true,
       "preserveConstEnums": true,
       "declarationMap": true,
       "lib":"es2018",
       "target": "esnext",
       "allowJs": true
   },
   "files": [
       "core.ts",
       "sys.ts",
       "types.ts",
       "scanner.ts",
       "parser.ts",
       "utilities.ts",
       "binder.ts",
       "checker.ts",
       "emitter.ts",
       "program.ts",
       "commandLineParser.ts",
       "tsc.ts",
       "diagnosticInformationMap.generated.ts"
   ]
}
1个回答

0

刚刚遇到了同样的问题。

我的问题在于像这样错误地调用tsc:

  "start": "node_modules/.bin/tsc index.ts --watch"

所以我改变了tsconfig,只包括入口点

"include": [
    "src/index.ts"
  ],

并命令为:

"start": "node_modules/.bin/tsc --watch"

一切都变得完美。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接