diff --git a/types/backbone/backbone-tests.ts b/types/backbone/backbone-tests.ts index c36b92ff3f..937d4f261a 100644 --- a/types/backbone/backbone-tests.ts +++ b/types/backbone/backbone-tests.ts @@ -196,6 +196,8 @@ class Library extends Backbone.Collection { class Books extends Backbone.Collection { } +class ArbitraryCollection extends Backbone.Collection { } + function test_collection() { var books = new Books(); @@ -483,3 +485,27 @@ namespace v1Changes { Backbone.sync('read', new EmployeeCollection()); } } + +interface BookViewOptions extends Backbone.ViewOptions { + featured: boolean; +} + +class BookView extends Backbone.View { + featured: boolean; + constructor(options: BookViewOptions) { + super(options); + this.featured = !!options.featured; + } +} + +interface ModellessViewOptions extends Backbone.ViewOptions { + color?: string; +} + +class ModellessView extends Backbone.View { + color: string; + constructor(options: ModellessViewOptions) { + super(options); + this.color = options.color; + } +} diff --git a/types/backbone/index.d.ts b/types/backbone/index.d.ts index 58e3735f2b..fc96e7f4a1 100644 --- a/types/backbone/index.d.ts +++ b/types/backbone/index.d.ts @@ -300,7 +300,7 @@ declare namespace Backbone { matches(attrs: any): boolean; } - class Collection extends ModelBase implements Events { + class Collection extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -492,7 +492,7 @@ declare namespace Backbone { private _updateHash(location: Location, fragment: string, replace: boolean): void; } - interface ViewOptions { + interface ViewOptions { model?: TModel; // TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view. collection?: Backbone.Collection; //was: Collection; @@ -504,7 +504,7 @@ declare namespace Backbone { attributes?: {[id: string]: any}; } - class View extends EventsMixin implements Events { + class View extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. @@ -547,7 +547,7 @@ declare namespace Backbone { } // SYNC - function sync(method: string, model: Model | Collection, options?: JQueryAjaxSettings): any; + function sync(method: string, model: Model | Collection, options?: JQueryAjaxSettings): any; function ajax(options?: JQueryAjaxSettings): JQueryXHR; var emulateHTTP: boolean; var emulateJSON: boolean; diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index ab605d9227..f5ae3a6788 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -8,7 +8,6 @@ "callable-types": false, "comment-format": false, "dt-header": false, - "npm-naming": false, "export-just-namespace": false, "interface-name": false, "jsdoc-format": false,