【问题标题】:compile typescript throws exception for using decorators编译 typescript 抛出使用装饰器的异常
【发布时间】:2016-02-23 07:07:00
【问题描述】:

我在一个 asp.net 核心项目中使用 Visual Studio 2015 和 TS 1.7.5。

我已经设置了一个初学者角度 2 5 分钟。教程。

当我尝试编译我的脚本文件夹时出现此异常:

为什么警告会导致进程失败?

app.component.ts

import {Component} from 'angular2/core';

@Component({
    selector: 'my-app',
    template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent { }

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]

}

【问题讨论】:

    标签: typescript visual-studio-2015 angular asp.net-core


    【解决方案1】:

    你的 tsconfig 看起来是正确的:

    "experimentalDecorators": true,
    

    我怀疑你有 两个 tsconfig.json 文件,如果它们不正确,还有一个。

    【讨论】:

    • 不,我的 Visual Studio 中的脚本下只有一个 tsconfig.json 文件。是不是 tsconfig.json 没有被 Visual Studio 以某种方式考虑,因为曾经是这种情况(在谷歌中读到它)可能还没有修复???
    • 找到另一个声音看到最后一个答案:stackoverflow.com/questions/32465760/…
    • 好的,安装 TS 1.8.2 后我得到了这个家伙的错误:github.com/angular/angular/issues/6468 HAHA... 仍然使用 Beta6 现在做 beta7 ng2 更新,让我们看看有什么问题 ;-)
    猜你喜欢
    • 1970-01-01
    • 2016-04-27
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    • 2020-06-09
    • 1970-01-01
    相关资源
    最近更新 更多