添加到现有 class 的内容的 TypeScript 类型?
TypeScript typings for something that adds to an existing class?
我正在尝试为 Backbone-Nested-Models 打字,为现有 Backbone.Model:
添加功能
/// <reference path="../backbone/backbone.d.ts" />
declare module Backbone {
class Events {
}
class ModelBase extends Events {
}
class Model extends ModelBase {
setRelation(attr, val, options):any;
set(key, val, options):any;
toJSON(options):any;
clone(options):any;
resetRelations(options):any;
reset(model,options):any;
}
}
declare module "backbone-nested-models" {
}
但它告诉我那些 类 已经存在。
我是否被迫将这些功能添加到我自己的 Backbone 类型中?
Am I forced to add these functions to my Backbone typings themselves?
目前是。
请看这个问题:https://github.com/Microsoft/TypeScript/issues/819#issuecomment-108656463
我正在尝试为 Backbone-Nested-Models 打字,为现有 Backbone.Model:
添加功能/// <reference path="../backbone/backbone.d.ts" />
declare module Backbone {
class Events {
}
class ModelBase extends Events {
}
class Model extends ModelBase {
setRelation(attr, val, options):any;
set(key, val, options):any;
toJSON(options):any;
clone(options):any;
resetRelations(options):any;
reset(model,options):any;
}
}
declare module "backbone-nested-models" {
}
但它告诉我那些 类 已经存在。
我是否被迫将这些功能添加到我自己的 Backbone 类型中?
Am I forced to add these functions to my Backbone typings themselves?
目前是。
请看这个问题:https://github.com/Microsoft/TypeScript/issues/819#issuecomment-108656463