[英]Using of TypeScript decorators caused errors
我在新的ASP.NET核心项目类型中使用TypeScript。
我们积极使用装饰器 。
不幸的是,这会导致VS2015输出中的大量错误:
Error TS1219 Experimental support for decorators is a feature that is subject to change in a future release.
Specify '--experimentalDecorators' to remove this warning.
WebApplication2 d:\documents\visual studio 2015\Projects\WebApplication2\src\WebApplication2\wwwroot\sources\app.ts 9 Active
在修改*.csproj
文件的常规ASP.NET项目中摆脱这些错误消息非常简单。
但ASP.NET Core项目不使用.csproj
,而是使用.xproj
。
那么,如何在ASP.NET Core项目中允许VS2015中的实验性TypeScript装饰器支持?
您可以找到最简单的项目,它可以在github示例代码中重现问题
Add
> New Item
。 Client-side
。 TypeScript JSON Configuration File
。 将其保留为tsconfig.json
的默认名称。 tsconfig.json
。 在complierOptions
部分中,添加"experimentalDecorators": true
。 "exclude"
部分删除"wwwroot"
。 这是我的tsconfig.json
文件的完整性:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"experimentalDecorators": true
},
"exclude": [
"node_modules"
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.