View 不是 Typescript 下 Backbone 的构造函数

View is not a constructor for Backbone under Typescript

我正在尝试在 Typescript 中创建一个 Backbone.js 视图。我收到以下错误:

TypeError: ExampleView is not a constructor in http://localhost:57258/Tests/spec/ExampleViewTest.js (line 17)

我的视图是这样实例化的:

var view = new ExampleView();

视图声明如下:

///<reference path="../Scripts/typings/backbone/backbone.d.ts"/>

class ExampleView extends Backbone.View {   
    constructor(options?: Backbone.ViewOptions) {
        super(options);
    }
};

更新: 查看 "compiled javascript file",浏览器给出的错误在倒数第二行:Backbone 未定义。我将如何导入它?

var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var ExampleView = (function (_super) {
    __extends(ExampleView, _super);
    function ExampleView() {
        _super.apply(this, arguments);
    }
    return Av;
})(Backbone.Model);
//# sourceMappingURL=av.js.map

Backbone is undefined. How would I import it?

使用脚本标签。或者像 requirejs 这样的外部模块加载器以及 AMD 模块 (--module amd)。更多:https://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1