mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-12 10:06:45 +08:00
Allow sort option for Backbone Collection.add and push. Issue #18593.
This commit is contained in:
@@ -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.
|
||||
|
||||
1
types/backbone/index.d.ts
vendored
1
types/backbone/index.d.ts
vendored
@@ -16,6 +16,7 @@ declare namespace Backbone {
|
||||
interface AddOptions extends Silenceable {
|
||||
at?: number;
|
||||
merge?: boolean;
|
||||
sort?: boolean;
|
||||
}
|
||||
|
||||
interface CollectionSetOptions extends Silenceable {
|
||||
|
||||
Reference in New Issue
Block a user