Visual studio typescriptUsingTsConfig在我的项目中不起作用
我正在GrunFile.js中执行以下grunt任务:Visual studio typescriptUsingTsConfig在我的项目中不起作用,visual-studio,angular,typescript,gruntjs,Visual Studio,Angular,Typescript,Gruntjs,我正在GrunFile.js中执行以下grunt任务: 'typescriptUsingTsConfig': { 'basic': { 'options': { 'rootDir': './ng2' } } } 我从任务成功运行的另一个项目复制了此任务。当我运行此任务时,我得到 这篇文章底部的错误。此项目安装了typescript的2.4.0版。我是 不知道这里少了什
'typescriptUsingTsConfig': {
'basic': {
'options': {
'rootDir': './ng2'
}
}
}
我从任务成功运行的另一个项目复制了此任务。当我运行此任务时,我得到
这篇文章底部的错误。此项目安装了typescript的2.4.0版。我是
不知道这里少了什么
====================================================================================================
C:\CODE\Test\src\Test.Website> cmd.exe /c grunt -b "C:\CODE\Test\src\Test.Website" --gruntfile "C:
\CODE\Test\src\Test.Website\Gruntfile.js" typescriptUsingTsConfig --color
Running "typescriptUsingTsConfig:basic" (typescriptUsingTsConfig) task
Running C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\Node.exe C:
\CODE\Test\src\Test.Website\node_modules\typescript\bin\tsc --project ./ng2
Warning: ng2/app.module.ts(1,21): error TS6053: File
'C:/CODE/Test/src/Test.Website/typings/globals/core-js/index.d.ts' not found.
ng2/services/user.service.ts(37,16): error TS2693: 'Promise' only refers to a type, but is being used
as a value here.
node_modules/@angular/common/src/directives/ng_class.d.ts(48,34): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/aot/compiler.d.ts(56,32): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(369,20): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(371,28): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(373,15): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(375,23): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(377,17): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(379,25): error TS2304: Cannot find name
'Set'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(458,63): error TS2304: Cannot find name
'Set'.
node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts(28,32): error
TS2304: Cannot find name 'Iterable'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,16): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(32,16): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts(15,48): error TS2304:
Cannot find name 'Iterable'.
node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts(23,18): error TS2304:
Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,123): error TS2304: Cannot find name
'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,165): error TS2304: Cannot find name
'Map'.
node_modules/@angular/http/src/headers.d.ts(52,71): error TS2304: Cannot find name 'Map'.
node_modules/@angular/http/src/url_search_params.d.ts(46,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot
find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name
'Map'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(11,30): error TS2304: Cannot
find name 'Set'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(22,30): error TS2304: Cannot
find name 'Set'.
node_modules/@angular/router/src/router_outlet_context.d.ts(42,28): error TS2304: Cannot find name
'Map'.
node_modules/@angular/router/src/router_outlet_context.d.ts(43,34): error TS2304: Cannot find name
'Map'.
node_modules/rxjs/Observable.d.ts(68,60): error TS2693: 'Promise' only refers to a type, but is being
used as a value here.
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class
'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator:
Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type 'T' is not assignable to type 'R'.
node_modules/rxjs/operator/toPromise.d.ts(3,79): error TS2693: 'Promise' only refers to a type, but is
being used as a value here. Use --force to continue.
Aborted due to warnings.
Process terminated with code 1.
C:\code\Test\src\Test.Website>cmd.exe/C grunt-b“C:\code\Test\src\Test.Website”--grunfile“C:
\CODE\Test\src\Test.Website\grunfile.js“typescriptUsingTsConfig--color
正在运行“typescriptUsingTsConfig:basic”(typescriptUsingTsConfig)任务
正在运行C:\Program Files(x86)\Microsoft Visual Studio\2017\Professional\Web\External\Node.exe C:
\CODE\Test\src\Test.Website\node\u modules\typescript\bin\tsc——项目。/ng2
警告:ng2/app.module.ts(1,21):错误TS6053:文件
未找到“C:/CODE/Test/src/Test.Website/typings/globals/core js/index.d.ts”。
ng2/services/user.service.ts(37,16):错误TS2693:“Promise”仅指类型,但正在使用
作为这里的一个值。
node_modules/@angular/common/src/directives/ng_class.d.ts(48,34):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/aot/compiler.d.ts(56,32):错误TS2304:找不到名称“Map”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(369,20):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(371,28):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(373,15):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(375,23):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(377,17):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/compile_metadata.d.ts(379,25):错误TS2304:找不到名称
“设置”。
node_modules/@angular/compiler/src/output/output_ast.d.ts(458,63):错误TS2304:找不到名称
“设置”。
node_modules/@angular/core/src/change_detection/differences/default_iterable_different.d.ts(28,32):错误
TS2304:找不到名称“Iterable”。
node_modules/@angular/core/src/change_detection/differences/default_keyvalue_different.d.ts(24,16):错误
TS2304:找不到名称“Map”。
node_modules/@angular/core/src/change_detection/differences/default_keyvalue_different.d.ts(32,16):错误
TS2304:找不到名称“Map”。
节点模块/@angular/core/src/change\u detection/differences/iterable\u differences.d.ts(15,48):错误TS2304:
找不到名称“Iterable”。
node_modules/@angular/core/src/change_detection/differences/keyvalue_differences.d.ts(23,18):错误TS2304:
找不到名称“Map”。
node_modules/@angular/core/src/di/reflective_provider.d.ts(87123):错误TS2304:找不到名称
“地图”。
node_modules/@angular/core/src/di/reflective_provider.d.ts(87165):错误TS2304:找不到名称
“地图”。
node_modules/@angular/http/src/headers.d.ts(52,71):错误TS2304:找不到名称“Map”。
node_modules/@angular/http/src/url_search_params.d.ts(46,16):错误TS2304:找不到名称“Map”。
node_modules/@angular/platform browser/src/browser/browser_adapter.d.ts(79,33):错误TS2304:无法
查找名称“Map”。
node_modules/@angular/platform browser/src/dom/dom_adapter.d.ts(97,42):错误TS2304:找不到名称
“地图”。
node_modules/@angular/platform browser/src/dom/shared_styles_host.d.ts(11,30):错误TS2304:无法
查找名称“Set”。
node_modules/@angular/platform browser/src/dom/shared_styles_host.d.ts(22,30):错误TS2304:无法
查找名称“Set”。
node_modules/@angular/router/src/router_outlet_context.d.ts(42,28):错误TS2304:找不到名称
“地图”。
node_modules/@angular/router/src/router_outlet_context.d.ts(43,34):错误TS2304:找不到名称
“地图”。
node_modules/rxjs/Observable.d.ts(68,60):错误TS2693:“Promise”仅指一个类型,但正在
在这里用作值。
node_modules/rxjs/Subject.d.ts(16,22):错误TS2415:类“Subject”错误地扩展了基类
“可观察的”。
“lift”属性的类型不兼容。
类型“(运算符:运算符)=>可观察的”不可分配给类型“(运算符:
运算符)=>可观察的'。
类型“Observable”不可分配给类型“Observable”。
类型“T”不可分配给类型“R”。
node_modules/rxjs/operator/toPromise.d.ts(3,79):错误TS2693:“Promise”仅指一个类型,但不是
在这里用作值。使用--force继续。
由于警告而中止。
进程以代码1终止。
更新
我根据对此线程的反馈更新了设置,但现在出现以下错误:
C:\CODE\Test.Web.Benport\src\Test.Web.Website> cmd.exe /c grunt -b "C:\CODE\Test.Web.Benport\src\Test.Web.Website" --gruntfile "C:\CODE\Test.Web.Benport\src\Test.Web.Website\Gruntfile.js" typescriptUsingTsConfig --color
Running "typescriptUsingTsConfig:basic" (typescriptUsingTsConfig) task
Running C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\Node.exe C:\CODE\Test.Web.Benport\src\Test.Web.Website\node_modules\typescript\bin\tsc --project ./ng2
Warning: node_modules/typescript/lib/lib.es2015.collection.d.ts(45,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.core.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(124,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts(133,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
typings/globals/core-js/index.d.ts(3,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/globals/core-js/index.d.ts(67,5): error TS2687: All declarations of 'name' must have identical modifiers.
typings/globals/core-js/index.d.ts(127,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.
typings/globals/core-js/index.d.ts(244,5): error TS2687: All declarations of 'flags' must have identical modifiers.
typings/globals/core-js/index.d.ts(258,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
typings/globals/core-js/index.d.ts(293,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
typings/globals/core-js/index.d.ts(300,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
typings/globals/core-js/index.d.ts(439,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
typings/globals/core-js/index.d.ts(439,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
typings/globals/core-js/index.d.ts(446,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
typings/globals/core-js/index.d.ts(474,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers.
typings/globals/core-js/index.d.ts(480,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers.
typings/globals/core-js/index.d.ts(486,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
typings/globals/core-js/index.d.ts(492,5): error TS2687: All declarations of 'match' must have identical modifiers.
typings/globals/core-js/index.d.ts(498,5): error TS2687: All declarations of 'replace' must have identical modifiers.
typings/globals/core-js/index.d.ts(504,5): error TS2687: All declarations of 'search' must have identical modifiers.
typings/globals/core-js/index.d.ts(510,5): error TS2687: All declarations of 'species' must have identical modifiers.
typings/globals/core-js/index.d.ts(516,5): error TS2687: All declarations of 'split' must have identical modifiers.
typings/globals/core-js/index.d.ts(522,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers.
typings/globals/core-js/index.d.ts(528,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers.
typings/globals/core-js/index.d.ts(534,5): error TS2687: All declarations of 'unscopables' must have identical modifiers.
typings/globals/core-js/index.d.ts(591,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.
typings/globals/core-js/index.d.ts(591,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
typings/globals/core-js/index.d.ts(595,5): error TS2403: Subsequent variable declarations must have the same type. Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.
typings/globals/core-js/index.d.ts(595,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
typings/globals/core-js/index.d.ts(610,5): error TS2687: All declarations of 'size' must have identical modifiers.
typings/globals/core-js/index.d.ts(616,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
typings/globals/core-js/index.d.ts(627,5): error TS2687: All declarations of 'size' must have identical modifiers.
typings/globals/core-js/index.d.ts(633,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
typings/globals/core-js/index.d.ts(638,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
typings/globals/core-js/index.d.ts(646,27): error TS2344: Type 'K' does not satisfy the constraint 'object'.
typings/globals/core-js/index.d.ts(647,53): error TS2344: Type 'K' does not satisfy the constraint 'object'.
typings/globals/core-js/index.d.ts(648,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.
typings/globals/core-js/index.d.ts(648,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
typings/globals/core-js/index.d.ts(662,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.
typings/globals/core-js/index.d.ts(662,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
typings/globals/core-js/index.d.ts(674,5): error TS2687: All declarations of 'value' must have identical modifiers.
typings/globals/core-js/index.d.ts(786,5): error TS2687: All declarations of 'prototype' must have identical modifiers. Use --force to continue.
Aborted due to warnings.
Process terminated with code 1.
C:\code\Test.Web.Benport\src\Test.Web.Website>cmd.exe/C grunt-b“C:\code\Test.Web.Benport\src\Test.Web.Website”--grunfile“C:\code\Test.Web.Benport\src\Test.Web.Website\grunfile.js”typescriptUsingTsConfig--color
正在运行“typescriptUsingTsConfig:basic”(typescriptUsingTsConfig)任务
正在运行C:\Program Files(x86)\Microsoft Visual Studio\2017\Professional\Web\External\Node.exe C:\CODE\Test.Web.Benport\src\Test.Web.Website\Node\u modules\typescript\bin\tsc--project。/ng2
警告:node_modules/typescript/lib/lib.es2015.collection.d.ts(45,11):错误TS2428:“WeakMap”的所有声明必须具有相同的类型参数。
node_modules/typescript/lib/lib.es2015.core.d.ts(21,14):错误TS2300:重复标识符“PropertyKey”。
node_modules/typescript/lib/lib.es2015.iterable.d.ts(124,11):错误TS2428:“WeakMap”的所有声明必须具有相同的类型参数。
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts(133,11):错误TS2428:“WeakMap”的所有声明必须具有相同的类型参数。
typings/globals/core js/index.d.ts(3,14):错误TS2300:重复标识符'PropertyKey'。
typings/globals/core js/index.d.ts(67,5):错误TS2687:“name”的所有声明必须具有相同的修饰符。
typings/globals/core js/index.d.ts(127,5):错误TS2
typings uninstall --save core-js
npm uninstall --save @types/core-js
{
"compilerOptions": {
"lib": ["dom", "es2015"],
// whatever else you had previously
}
}