IntelliJ和Angular 2参数类型不可分配错误

Xer*_*ati 5 intellij-idea angularjs typescript typescript1.7 intellij-15

IntelliJ中的Angular2(v15的最新更新 - 终极版)应该有效吗?所有的文档似乎都说它是通过AngularJS插件完成的,但我得到的是奇怪的智能感知错误.例如;

bootstrap(App, [
    ROUTER_PROVIDERS,
    provide(LocationStrategy, {useClass: HashLocationStrategy})
]);
Run Code Online (Sandbox Code Playgroud)

抛出  Argument type App is not assignable to parameter type Type

和标准注释一样;

@RouteConfig([
    {path: '/...', component: RootView, as: 'RootView', useAsDefault: true}
])
Run Code Online (Sandbox Code Playgroud)

Argument type {path: string, component: RootView, as: string, useAsDefault: boolean}[] is not assignable to parameter type RouteDefinition[]

以前有人碰过这个吗?有谁知道如何让smartJ玩得好听?

按要求提供应用程序来源;

import {Component, ViewEncapsulation} from 'angular2/core';
import {RootView} from './root-view';
import {
    RouteConfig,
    ROUTER_DIRECTIVES
} from 'angular2/router';

@Component({
    selector: 'app',
    templateUrl: './components/app/app.html',
    encapsulation: ViewEncapsulation.None,
    directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
    {path: '/...', component: RootView, as: 'RootView', useAsDefault: true}
])
export class App {
}
Run Code Online (Sandbox Code Playgroud)

Xer*_*ati 2

事实证明,由于我无法解释的原因,需要一个构造函数,否则 IntelliJ 会变得非常混乱,并且这种混乱会一直沿着依赖链向下延伸。

在我的例子中,修复很简单,App 中的默认空构造函数:

export class App {
    constructor() {}
}
Run Code Online (Sandbox Code Playgroud)

但 Angular2 与 IntelliJ 的一般经验法则似乎是 DI 链中所有内容的构造函数——至少目前是这样。我认为这是一个错误,将在 IntelliJ 的 Angular 插件中修复——我刚刚将其提交给他们。

  • 在我的所有类上添加构造函数并没有解决它。 (3认同)
  • 您可以添加指向您提交的错误的链接吗? (2认同)