tsconfig для машинописного текста для поддержки ошибки бросков цели es5
Мой tsConfig.json
как показано ниже:
{
"compilerOptions": {
"target":"es5",
"module":"system",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"sourceMap": true,
"moduleResolution": "node",
"lib": [ "es2015", "dom" ]
},
"exclude": [
"node_modules"
]
}
Но когда я пытаюсь бежать npm start
Это выдает ошибку
TS5023: Неизвестная опция компилятора 'lib'.
Итак, когда я удалил lib
из tsConfig:
{
"compilerOptions": {
"target":"es5",
"module":"system",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"sourceMap": true,
"moduleResolution": "node"
},
"exclude": [
"node_modules"
]
}
и использовал npm start
снова
Затем он начал выдавать ошибку (ы):
node_modules/@angular/common/src/directives/ng_class.d.ts(46,34): error TS2304: Cannot find name 'Set'.
node_modules/@angular/common/src/pipes/async_pipe.d.ts(44,38): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(369,30): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(415,30): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(416,20): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(417,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(418,246): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(38,72): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(40,74): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/metadata_resolver.d.ts(62,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(18,32): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(32,87): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(49,9): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(427,63): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/resource_loader.d.ts(13,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/runtime_compiler.d.ts(44,49): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/runtime_compiler.d.ts(46,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/util.d.ts(26,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/util.d.ts(27,46): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_init.d.ts(16,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(106,67): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(122,101): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(148,67): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(150,101): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(28,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(88,123): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(88,165): error TS2304: Cannot find name 'Map'.
...
Странно но конфиг:
{
"compilerOptions": {
"target":"es6",
"module":"system",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"sourceMap": true,
"moduleResolution": "node"
},
"exclude": [
"node_modules"
]
}
Работает очень хорошо для меня.
Но в качестве цели есть es6; Я не могу перейти на старые браузеры, такие как IE.
Эксперты здесь, пожалуйста, посмотрите на это? Может быть, это небольшая проблема, о которой я не знаю.
Любая помощь с благодарностью.
Для получения дополнительной информации:
>npm --version
3.10.10
>tsc --version
Version 2.3.4
>node --version
v6.10.2