我如何在 Visual Studio 2015 中設置 TypeScript 編譯器選項
有許多 TypeScript 的設定通常會在 tsconfig.json 檔案中指定。例如,我想要設定 ExperimentalDecorators 的值。
VS 2015 支援新增 tsconfig.json 檔案,預設內容如下:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"wwwroot"
]
}
然而,嘗試建置會導致此錯誤:「無法取得屬性 'compilerOptions' 的值:物件為空或未定義」
有人建議將其添加到專案檔案中:
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
...
<TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
</PropertyGroup>
這也被拒絕了。我找不到任何解決辦法。