我一直有这个错误。我已经将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"
]
}
答案 0 :(得分:0)
刚遇到同样的问题。
我的问题是在这里调用tsc不正确:
"start": "node_modules/.bin/tsc index.ts --watch"
所以我改变了tsconfig以仅包含入口点
"include": [
"src/index.ts"
],
并命令:
"start": "node_modules/.bin/tsc --watch"
一切都变得完美。