diff --git a/types/backbone-associations/index.d.ts b/types/backbone-associations/index.d.ts index d0681c6651..c93eb965e8 100644 --- a/types/backbone-associations/index.d.ts +++ b/types/backbone-associations/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Backbone-associations 0.6.4 -// Project: https://github.com/dhruvaray/backbone-associations/ +// Project: http://dhruvaray.github.io/backbone-associations // Definitions by: Craig Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index f19cfa8daa..e9cc5e71ff 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -7,180 +7,163 @@ /// -import { Events, EventsHash, Model as BModel, Collection } from 'backbone'; +import { EventsMixin, Events, Model as BModel, Collection } from 'backbone'; -declare module 'backbone-relational' { - class Model extends BModel { - /** - * Do not use, prefer TypeScript's extend functionality. - **/ - //private static extend(properties:any, classProperties?:any):any; +export class Model extends BModel { + /** + * Do not use, prefer TypeScript's extend functionality. + **/ + //private static extend(properties:any, classProperties?:any):any; - relations:any; - subModelTypes:any; - subModelTypeAttribute:any; + relations:any; + subModelTypes:any; + subModelTypeAttribute:any; - initializeRelations(options:any):void; + initializeRelations(options:any):void; - updateRelations(options:any):void; + updateRelations(options:any):void; - queue(func:any):void; + queue(func:any):void; - processQueue():void; + processQueue():void; - getRelation(name:string):Relation; + getRelation(name:string):Relation; - getRelations():Relation[]; + getRelations():Relation[]; - fetchRelated(key:string, options?:any, update?:boolean):any; + fetchRelated(key:string, options?:any, update?:boolean):any; - toJSON(options?: any):any; + toJSON(options?: any):any; - static setup(); + static setup(); - static build(attributes:any, options?:any); + static build(attributes:any, options?:any); - static findOrCreate(attributes:string, options?:any); + static findOrCreate(attributes:string, options?:any); - static findOrCreate(attributes:number, options?:any); + static findOrCreate(attributes:number, options?:any); - static findOrCreate(attributes:any, options?:any); - } + static findOrCreate(attributes:any, options?:any); +} - export class Relation extends BModel { +export class Relation extends BModel { - options:any; - instance:any; - key:any; - keyContents:any; - relatedModel:any; - relatedCollection:any; - reverseRelation:any; - related:any; + options:any; + instance:any; + key:any; + keyContents:any; + relatedModel:any; + relatedCollection:any; + reverseRelation:any; + related:any; - checkPreconditions():boolean; + checkPreconditions():boolean; - setRelated(related:BModel):void; + setRelated(related:BModel):void; - setRelated(related:Collection):void; + setRelated(related:Collection):void; - getReverseRelations(model:Model):Relation; + getReverseRelations(model:Model):Relation; - destroy():void; - } + destroy():void; +} - export class HasOne extends Relation { - collectionType:any; +export class HasOne extends Relation { + collectionType:any; - findRelated(options:any):BModel; + findRelated(options:any):BModel; - setKeyContents(keyContents:string):void; + setKeyContents(keyContents:string):void; - setKeyContents(keyContents:string[]):void; + setKeyContents(keyContents:string[]):void; - setKeyContents(keyContents:number):void; + setKeyContents(keyContents:number):void; - setKeyContents(keyContents:number[]):void; + setKeyContents(keyContents:number[]):void; - setKeyContents(keyContents:Collection):void; + setKeyContents(keyContents:Collection):void; - onChange(model:BModel, attr:any, options:any):void; + onChange(model:BModel, attr:any, options:any):void; - handleAddition(model:BModel, coll:Collection, options:any):void; + handleAddition(model:BModel, coll:Collection, options:any):void; - handleRemoval(model:BModel, coll:Collection, options:any):void; + handleRemoval(model:BModel, coll:Collection, options:any):void; - handleReset(coll:Collection, options:any):void; + handleReset(coll:Collection, options:any):void; - tryAddRelated(model:BModel, coll:any, options:any):void; + tryAddRelated(model:BModel, coll:any, options:any):void; - addRelated(model:BModel, options:any):void; + addRelated(model:BModel, options:any):void; - removeRelated(model:BModel, coll:any, options:any):void; - - } - - - export class HasMany extends Relation { - collectionType:any; - - findRelated(options:any):BModel; - - setKeyContents(keyContents:string):void; - - setKeyContents(keyContents:number):void; - - setKeyContents(keyContents:BModel):void; - - onChange(model:BModel, attr:any, options:any):void; - - tryAddRelated(model:BModel, coll:any, options:any):void; - - addRelated(model:BModel, options:any):void; - - removeRelated(model:BModel, coll:any, options:any):void; - - } - - export class Store implements Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; - on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; - - initializeRelation(model, relation, options); - - addModelScope(scope:any):void; - - removeModelScope(scope):void; - - addSubModels(subModelTypes:Model, superModelType:Model):void; - - setupSuperModel(modelType:Model):void; - - addReverseRelation(relation:any):void; - - addOrphanRelation(relation:any):void; - - processOrphanRelations():void; - - retroFitRelation(relation:Model, create:boolean):Collection; - - getCollection(type:Model, create:boolean):Collection; - - getObjectByName(name:string):any; - - - resolveIdForItem(type:any, item:any):any; - - static find(type:any, item:string):Model; - - static find(type:any, item:number):Model; - - static find(type:any, item:Model):Model; - - static find(type:any, item:any):Model; - - register(model:Model):void; - - checkId(model:Model, id:any):void; - - update(model:Model):void; - - unregister(model:Model, collection:Collection, options:any):void; - - reset():void; - - - } + removeRelated(model:BModel, coll:any, options:any):void; } + +export class HasMany extends Relation { + collectionType:any; + + findRelated(options:any):BModel; + + setKeyContents(keyContents:string):void; + + setKeyContents(keyContents:number):void; + + setKeyContents(keyContents:BModel):void; + + onChange(model:BModel, attr:any, options:any):void; + + tryAddRelated(model:BModel, coll:any, options:any):void; + + addRelated(model:BModel, options:any):void; + + removeRelated(model:BModel, coll:any, options:any):void; + +} + +export class Store extends EventsMixin implements Events { + initializeRelation(model, relation, options); + + addModelScope(scope:any):void; + + removeModelScope(scope):void; + + addSubModels(subModelTypes:Model, superModelType:Model):void; + + setupSuperModel(modelType:Model):void; + + addReverseRelation(relation:any):void; + + addOrphanRelation(relation:any):void; + + processOrphanRelations():void; + + retroFitRelation(relation:Model, create:boolean):Collection; + + getCollection(type:Model, create:boolean):Collection; + + getObjectByName(name:string):any; + + + resolveIdForItem(type:any, item:any):any; + + static find(type:any, item:string):Model; + + static find(type:any, item:number):Model; + + static find(type:any, item:Model):Model; + + static find(type:any, item:any):Model; + + register(model:Model):void; + + checkId(model:Model, id:any):void; + + update(model:Model):void; + + unregister(model:Model, collection:Collection, options:any):void; + + reset():void; + +} diff --git a/types/backbone-relational/tslint.json b/types/backbone-relational/tslint.json index a41bf5d19a..65e27fce52 100644 --- a/types/backbone-relational/tslint.json +++ b/types/backbone-relational/tslint.json @@ -1,79 +1,24 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, "comment-format": false, "dt-header": false, "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, - "object-literal-shorthand": false, "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, "prefer-template": false, - "radix": false, - "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, "whitespace": false } } diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts index 1025940214..f24d80ff4d 100644 --- a/types/backbone.marionette/index.d.ts +++ b/types/backbone.marionette/index.d.ts @@ -6,6 +6,7 @@ // Volker Nauruhn , // Ard Timmerman , // J. Joe Koullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -407,20 +408,14 @@ export interface ObjectOptions extends RadioMixinOptions { * A base class which other classes can extend from. Object incorporates many * backbone conventions and utilities like initialize and Backbone.Events. */ -export class Object implements CommonMixin, RadioMixin, Backbone.Events { +export class Object extends Backbone.EventsMixin implements CommonMixin, RadioMixin, Backbone.Events { constructor(options?: ObjectOptions); - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; /** * Receives a hash of event names and functions and/or function names, diff --git a/types/backbone.radio/index.d.ts b/types/backbone.radio/index.d.ts index ac953aa00b..e6682bd52e 100644 --- a/types/backbone.radio/index.d.ts +++ b/types/backbone.radio/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Backbone.Radio v0.8.3 // Project: https://github.com/marionettejs/backbone.radio // Definitions by: Peter Palotas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -71,18 +72,12 @@ declare module "backbone" { stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests; } - class Channel implements Commands, Requests, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; + class Channel extends Backbone.EventsMixin implements Commands, Requests, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; channelName: string; reset(): Channel; diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index 563c21634c..c36b92ff3f 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -15,6 +15,50 @@ function test_events() { object.off(); } +class PubSub implements Backbone.Events { + on: Backbone.Events_On; + off: Backbone.Events_Off; + trigger: Backbone.Events_Trigger; + bind: Backbone.Events_On; + unbind: Backbone.Events_Off; + + once: Backbone.Events_On; + listenTo: Backbone.Events_Listen; + listenToOnce: Backbone.Events_Listen; + stopListening: Backbone.Events_Stop; +} + +Object.assign(PubSub.prototype, Backbone.Events); + +function test_events_shorthands() { + let channel1 = new PubSub(); + let channel2 = new PubSub(); + let onChange = () => alert('whatever'); + + channel1.on("alert", (eventName: string) => alert("Triggered " + eventName)); + channel1.trigger("alert", "an event"); + + channel1.once('invalid', () => { }, this); + channel1.once('invalid', () => { }); + channel1.once({invalid: () => { }, success: () => { }}, this); + channel1.once({invalid: () => { }, success: () => { }}); + + channel1.off("change", onChange); + channel1.off("change"); + channel1.off(null, onChange); + channel1.off(null, null, this); + channel1.off(); + + channel2.listenTo(channel1, 'invalid', () => { }); + channel2.listenTo(channel1, {invalid: () => { }, success: () => { }}); + channel2.listenToOnce(channel1, 'invalid', () => { }); + channel2.listenToOnce(channel1, {invalid: () => { }, success: () => { }}); + + channel2.stopListening(channel1, 'invalid', () => { }); + channel2.stopListening(channel1, 'invalid'); + channel2.stopListening(channel1); +} + class SettingDefaults extends Backbone.Model { // 'defaults' could be set in one of the following ways: @@ -272,18 +316,22 @@ namespace v1Changes { var model = new Employee; model.once('invalid', () => { }, this); model.once('invalid', () => { }); + model.once({invalid: () => { }, success: () => { }}, this); + model.once({invalid: () => { }, success: () => { }}); } function test_listenTo() { var model = new Employee; var view = new Backbone.View(); view.listenTo(model, 'invalid', () => { }); + view.listenTo(model, {invalid: () => { }, success: () => { }}); } function test_listenToOnce() { var model = new Employee; var view = new Backbone.View(); view.listenToOnce(model, 'invalid', () => { }); + view.listenToOnce(model, {invalid: () => { }, success: () => { }}); } function test_stopListening() { @@ -398,7 +446,7 @@ namespace v1Changes { namespace Collection { function test_fetch() { var collection = new EmployeeCollection; - collection.fetch({ + collection.fetch({ reset: true, remove: false }); diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index a881284c8f..58e3735f2b 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -1,9 +1,11 @@ // Type definitions for Backbone 1.3.3 // Project: http://backbonejs.org/ +// https://github.com/jashkenas/backbone // Definitions by: Boris Yankov // Natan Vivo // kenjiru // jjoekoullas +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -91,44 +93,113 @@ declare namespace Backbone { [routePattern: string]: string | {(...urlParts: string[]): void}; } + /** + * DOM events (used in the events property of a View) + */ interface EventsHash { [selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void}; } - export const Events: Events; - interface Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: EventsHash): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; + /** + * JavaScript events (used in the methods of the Events interface) + */ + interface EventHandler { + (...args: any[]): void; + } + interface EventMap { + [event: string]: EventHandler; } - class ModelBase implements Events { - on(eventName: string, callback?: Function, context?: any): any; - on(eventMap: EventsHash): any; - on(eventName: any, callback?: any, context?: any): any - off(eventName?: string, callback?: Function, context?: any): any - trigger(eventName: string, ...args: any[]): any - bind(eventName: string, callback: Function, context?: any): any - unbind(eventName?: string, callback?: Function, context?: any): any - once(events: string, callback: Function, context?: any): any - listenTo(object: any, events: string, callback: Function):any - listenToOnce(object: any, events: string, callback: Function): any - stopListening(object?: any, events?: string, callback?: Function): any + export const Events: Events; + interface Events extends EventsMixin { } + /** + * Helper shorthands for classes that implement the Events interface. + * Define your class like this: + * + * import { + * Events, + * Events_On, + * Events_Off, + * Events_Trigger, + * Events_Listen, + * Events_Stop, + * } from 'backbone'; + * + * class YourClass implements Events { + * on: Events_On; + * off: Events_Off; + * trigger: Events_Trigger; + * bind: Events_On; + * unbind: Events_Off; + * + * once: Events_On; + * listenTo: Events_Listen; + * listenToOnce: Events_Listen; + * stopListening: Events_Stop; + * + * // ... (other methods) + * } + * + * Object.assign(YourClass.prototype, Events); // can also use _.extend + * + * If you are just writing a class type declaration that doesn't already + * extend some other base class, you can use the EventsMixin instead; + * see below. + */ + interface Events_On { + (this: T, eventName: string, callback: EventHandler, context?: any): T; + (this: T, eventMap: EventMap, context?: any): T; + } + interface Events_Off { + (this: T, eventName?: string, callback?: EventHandler, context?: any): T; + } + interface Events_Trigger { + (this: T, eventName: string, ...args: any[]): T; + } + interface Events_Listen { + (this: T, object: any, events: string, callback: EventHandler): T; + (this: T, object: any, eventMap: EventMap): T; + } + interface Events_Stop { + (this: T, object?: any, events?: string, callback?: EventHandler): T; + } + + /** + * Helper to avoid code repetition in type declarations. + * Backbone.Events cannot be extended, hence a separate abstract + * class with a different name. Both classes and interfaces can + * extend from this helper class to reuse the signatures. + * + * For class type declarations that already extend another base + * class, and for actual class definitions, please see the + * Events_* interfaces above. + */ + abstract class EventsMixin implements Events { + on(eventName: string, callback: EventHandler, context?: any): this; + on(eventMap: EventMap, context?: any): this; + off(eventName?: string, callback?: EventHandler, context?: any): this; + trigger(eventName: string, ...args: any[]): this; + bind(eventName: string, callback: EventHandler, context?: any): this; + bind(eventMap: EventMap, context?: any): this; + unbind(eventName?: string, callback?: EventHandler, context?: any): this; + + once(events: string, callback: EventHandler, context?: any): this; + once(eventMap: EventMap, context?: any): this; + listenTo(object: any, events: string, callback: EventHandler): this; + listenTo(object: any, eventMap: EventMap): this; + listenToOnce(object: any, events: string, callback: EventHandler): this; + listenToOnce(object: any, eventMap: EventMap): this; + stopListening(object?: any, events?: string, callback?: EventHandler): this; + } + + class ModelBase extends EventsMixin { parse(response: any, options?: any): any; toJSON(options?: any): any; sync(...arg: any[]): JQueryXHR; } - class Model extends ModelBase { + class Model extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -229,7 +300,7 @@ declare namespace Backbone { matches(attrs: any): boolean; } - class Collection extends ModelBase { + class Collection extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -367,7 +438,7 @@ declare namespace Backbone { without(...values: TModel[]): TModel[]; } - class Router extends EventSignatures { + class Router extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -396,7 +467,7 @@ declare namespace Backbone { var history: History; - class History extends EventSignatures { + class History extends EventsMixin implements Events { handlers: any[]; interval: number; @@ -433,7 +504,7 @@ declare namespace Backbone { attributes?: {[id: string]: any}; } - class View extends EventSignatures { + class View extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -485,21 +556,3 @@ declare namespace Backbone { function noConflict(): typeof Backbone; var $: JQueryStatic; } - -/** - * This is not for external use and is only here as a convenient way to - * specify signatures for internal implementers of Backbone.Events - */ -declare abstract class EventSignatures implements Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any): any; - on(eventMap: Backbone.EventsHash): any; - off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - trigger(eventName: string, ...args: any[]): any; - bind(eventName: string, callback: (...args: any[]) => void, context?: any): any; - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any; - - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; -} \ No newline at end of file diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index d67ffb3a73..f5ae3a6788 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -8,73 +8,35 @@ "callable-types": false, "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, "jsdoc-format": false, "max-line-length": false, "member-access": false, "new-parens": false, "no-angle-bracket-type-assertion": false, "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, "no-namespace": false, "no-object-literal-type-assertion": false, "no-padding": false, "no-redundant-jsdoc": false, "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, "no-unnecessary-generics": false, "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, "no-void-expression": false, - "no-trailing-whitespace": false, "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, "prefer-method-signature": false, "prefer-template": false, - "radix": false, "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, "typedef-whitespace": false, "unified-signatures": false, - "void-return": false, "whitespace": false } } diff --git a/types/giraffe/index.d.ts b/types/giraffe/index.d.ts index abce777c20..2f0223321c 100644 --- a/types/giraffe/index.d.ts +++ b/types/giraffe/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Giraffe // Project: https://github.com/barc/backbone.giraffe // Definitions by: Matt McCray +// Julian Gonggrijp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -145,18 +146,12 @@ declare namespace Giraffe { namespace Contrib { - class Controller implements GiraffeObject, Backbone.Events { - on(eventName: string, callback?: (...args: any[]) => void, context?: any); - on(eventMap: Backbone.EventsHash); + class Controller extends Backbone.EventsMixin implements GiraffeObject, Backbone.Events { + /** + * Faulty overgeneralization of Backbone.Events.on, for historical + * reasons. + */ on(eventName: any, callback?: any, context?: any) - off(eventName?: string, callback?: (...args: any[]) => void, context?: any) - trigger(eventName: string, ...args: any[]) - bind(eventName: string, callback: (...args: any[]) => void, context?: any) - unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any) - once(events: string, callback: (...args: any[]) => void, context?: any): any; - listenTo(object: any, events: string, callback: (...args: any[]) => void): any; - listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any; - stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any; app: App; } diff --git a/types/knockback/index.d.ts b/types/knockback/index.d.ts index 68b9dc9e0b..59f3e3fa93 100644 --- a/types/knockback/index.d.ts +++ b/types/knockback/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Knockback.js -// Project: http://kmalakoff.github.io/knockback/ +// Project: http://kmalakoff.github.com/knockback // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3