如何在 Visual Studio 2015 RTM 中设置 TypeScriptTarget [英] How to set TypeScriptTarget in Visual Studio 2015 RTM
问题描述
我尝试构建项目 https://github.com/Justin-Credible/Ionic-TypeScript-MDHA-Starter 但得到很多错误:<代码>错误 TS1056:构建:访问器仅在面向 ECMAScript 5 及更高版本时可用.
I try to build the project https://github.com/Justin-Credible/Ionic-TypeScript-MDHA-Starter but get lots of error:
error TS1056: Build: Accessors are only available when targeting ECMAScript 5 and higher.
我编辑了项目文件 JustinCredible.SampleApp.jsproj
,将 TypeScriptTarget
添加为:<代码><属性组><TypeScriptToolsVersion>1.5</TypeScriptToolsVersion><TypeScriptTarget>ES5</TypeScriptTarget><DefaultReferenceGroup>隐式 (Apache Cordova)</DefaultReferenceGroup></PropertyGroup>但错误仍然存在.
I editted the project file JustinCredible.SampleApp.jsproj
by adding TypeScriptTarget
as:
<PropertyGroup>
<TypeScriptToolsVersion>1.5</TypeScriptToolsVersion>
<TypeScriptTarget>ES5</TypeScriptTarget>
<DefaultReferenceGroup>Implicit (Apache Cordova)</DefaultReferenceGroup>
</PropertyGroup>
but the error was still there.
我错过了什么吗?
推荐答案
您需要在 Sample-App\scripts 文件夹中添加一个 tsconfig.json 文件,其中包含以下内容:
You need to add a tsconfig.json file in the Sample-App\scripts folder with the following content:
{
"compilerOptions": {
"target": "es5",
"out": "www/scripts/appBundle.js",
"sourceMap": true,
"removeComments": true,
"sourceRoot": "/"
}
}
这篇关于如何在 Visual Studio 2015 RTM 中设置 TypeScriptTarget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!