Visual Studio 2015 项目 [typescript 1.8] 上的多个 tsconfig

Multiple tsconfig on a Visual Studio 2015 Project [typescript 1.8]

我有一个使用打字稿的 MVC 5 项目。 现在我必须实现新功能我打开其他打字稿实现方式。 我正在尝试使用 typescript 1.8 的多个 tsconfig.json 文件新功能,我有两个文件夹:typescriptE21typescript,每个文件夹上都有一个 tsconfig.json 文件。

第一个:

{
    "compilerOptions": {
        "removeComments": false,
        "sourceMap": false,
        "target": "es5",
        "noImplicitAny": false,
        "module": "amd",
        "declaration": false,
        "noEmitOnError": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "compileOnSave": true,
    "exclude": [
        "node_modules",
        "typescript"
    ]
}

第二个:

{
    "compilerOptions": {
        "removeComments": false,
        "sourceMap": false,
        "target": "es5",
        "noImplicitAny": false,
        "module": "system",
        "declaration": false,
        "noEmitOnError": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "inlineSourceMap": true,
        "inlineSources": true
    },
    "compileOnSave": true,
    "exclude": [
        "node_modules",
        "typescript21",
        "scripts"
    ]
}

当我在 Typescript 部分打开项目属性时说 "One or more tsconfig.json files detected. Project properties are disabled." 是正确的但是当我 运行 应用程序时我得到这个错误:

Build: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning

关于这个文件:

import {Component} from "ngts/ngts";

@Component({
    template: `<div md-scroll-y flex class="md-padding" id="contenido">Contenido</div>`
})
export class EmAplicacion {

}

在两个 tsconfig.json 文件中,我都激活了装饰器,但似乎打字稿没有从那里获得编译器选项...

此外,当我不使用装饰器时,它会编译,但我可以看到结果文件,当我将 "system" 放入第二个配置文件时,它们是使用 AMD 模块系统发出的...

有什么问题吗?

真正的问题是 tsconfig.json 文件包含在项目中:

<None Include="typescript\tsconfig.json" />

我已经更改为;

<Content Include="typescript\tsconfig.json" />

一切都好

这也有帮助:

  1. 打开解决方案资源管理器
  2. 右键单击 tsconfig.json 文件并选择 'Exclude From Project'。
  3. 您可能会看到 tsconfig.json 从解决方案资源管理器中消失。在这种情况下,从顶部选择 'Show All Files' 选项 解决方案资源管理器工具栏。
  4. 右键单击 tsconfig.json 并选择 'Include In Project'。