Allow sort option for Backbone Collection.add and push. Issue #18593.

This commit is contained in:
Randy Patterson Jr
2017-10-16 10:44:21 -04:00
parent 85fdbd170e
commit cbb468143e
2 changed files with 4 additions and 0 deletions

View File

@@ -157,6 +157,9 @@ function test_collection() {
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
books.add(book1);
// Test adding sort option to add.
books.add(new Book(), { sort: true });
// Objects can be added to collection by casting to model type.
// Compiler will check if object properties are valid for the cast.
// This gives better type checking than declaring an `any` overload.

View File

@@ -16,6 +16,7 @@ declare namespace Backbone {
interface AddOptions extends Silenceable {
at?: number;
merge?: boolean;
sort?: boolean;
}
interface CollectionSetOptions extends Silenceable {