2016-02-22 64 views
0

我在asp.net核心项目中使用带有TS 1.7.5的Visual Studio 2015。编译打字稿抛出使用装饰器的异常

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

,当我尝试编译我的脚本文件夹中我得到这个异常:

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

enter image description here

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" 
    ] 

} 

回答

0

您tsconfig看起来是正确的:

"experimentalDecorators": true, 

我怀疑你有两个 tsconfig.json文件和一个,如果他们是不正确的。

+0

不,在我的visual studio的脚本下只有一个tsconfig.json文件。可能是tsconfig.json不被视觉工作室认为是因为那曾经是这种情况(在google中阅读过)可能它不是固定的? – Elisabeth

+0

发现另一个声音看到最后回答:http://stackoverflow.com/questions/32465760/visual-studio-2015-tsconfig-json-typescript-1-6-0-beta – Elisabeth

+0

安装TS 1.8.2后好吧,我得到这个家伙错误:https://github.com/angular/angular/issues/6468 HAHA ...仍然使用Beta6现在做beta7 ng2 upadate,让我们看看什么时候休息一下;-) – Elisabeth