Update Backbone collection.comparator definition to accpet string and Function types. Closes #6394.

This commit is contained in:
Randy Patterson Jr
2016-03-04 09:00:25 -05:00
parent 600e53d88c
commit 9bec26ff32
3 changed files with 16 additions and 4 deletions
+4 -2
View File
@@ -192,8 +192,10 @@ declare module Backbone {
fetch(options?: CollectionFetchOptions): JQueryXHR;
comparator(element: TModel): number;
comparator(compare: TModel, to?: TModel): number;
/**
* Specify a model attribute name (string) or function that will be used to sort the collection.
*/
comparator: string | ((element: TModel) => number | string) | ((compare: TModel, to?: TModel) => number);
add(model: {}|TModel, options?: AddOptions): TModel;
add(models: ({}|TModel)[], options?: AddOptions): TModel[];