Changed changedAttributes method to return any, instead of any | boolean. And added some JSDoc to describe its behaviour.

This commit is contained in:
Erik Krogh Kristensen
2016-08-05 23:44:52 +02:00
parent fe66d4219d
commit f614c7b3d4
2 changed files with 9 additions and 2 deletions

View File

@@ -153,7 +153,14 @@ declare namespace Backbone {
/*private*/ set(attributeName: string, value: any, options?: ModelSetOptions): Model;
set(obj: any, options?: ModelSetOptions): Model;
changedAttributes(attributes?: any): any | boolean;
/**
* Return an object containing all the attributes that have changed, or
* false if there are no changed attributes. Useful for determining what
* parts of a view need to be updated and/or what attributes need to be
* persisted to the server. Unset attributes will be set to undefined.
* You can also pass an attributes object to diff against the model,
* determining if there *would be* a change. */
changedAttributes(attributes?: any): any;
clear(options?: Silenceable): any;
clone(): Model;
destroy(options?: ModelDestroyOptions): any;

View File

@@ -1,4 +1,4 @@
// Type definitions for Backbone 1.0.0
// Type definitions for Backbone 1.3.3
// Project: http://backbonejs.org/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Natan Vivo <https://github.com/nvivo/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped