具有.NET CORE 2.2项目始于角模板。用新的CLI生成的Angular 7应用代替/客户端文件夹。两个与构建&NG构建无问题。但是,在" VS错误列表"选项卡上大约有16个与TS相关的错误,其中3个是
Error TS2304 (TS) Cannot find name 'Iterable'.
Error TS2583 (TS) Cannot find name 'Map'.
Error TS1219 (TS) Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
这让我发疯。有人偶然发现了这个问题吗?
我的tsconfig.json文件
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
[update] 只是为了添加详细信息 - 我注意到这些错误都在引用相同的文件,这是我最近通过VS>>添加新项目>打字稿文件添加的文件。事实证明,这会在csproj文件中添加文件引用,例如:
<!--<ItemGroup>
<None Remove="ClientAppsrcappmycomponentmysvc.service.ts" />
</ItemGroup>-->
<!--<ItemGroup>
<TypeScriptCompile Include="ClientAppsrcappmycomponentaudit.service.ts" />
<TypeScriptCompile Include="ClientAppsrcappsharedmodelscommodel-result.model.ts" />
</ItemGroup>-->
好的,所以最终设法解决了这个问题,但仍然没有真正理解为什么类型开始造成麻烦,这就是我所做的。请参阅上面的帖子中的更新。我在CSPROJ文件中评论了文件引用,"假" TS错误消失了。
对自我和他人的注意 - 最好通过Angular CLI添加新的Angular组件/服务文件以避免这种情况。