Skip to content

Commit 196dcbf

Browse files
committed
types: callback is optional
1 parent d356e4d commit 196dcbf

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/eventemitter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function EventEmitter(Base) {
9595
* callbacks for the event. If `name` is null, removes all bound
9696
* callbacks for all events.
9797
* @param {string} name
98-
* @param {EventCallback} callback
98+
* @param {EventCallback} [callback]
9999
* @param {any} [context]
100100
* @return {EventEmitter}
101101
*/

src/types/collection.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ declare const Collection_base: {
1010
listenTo(obj: any, name: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): /*elided*/ any;
1111
_listeningTo: {};
1212
_listenId: any;
13-
off(name: string, callback: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
13+
off(name: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
1414
stopListening(obj?: any, name?: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): /*elided*/ any;
1515
once(name: string, callback: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any, context: any): /*elided*/ any;
1616
listenToOnce(obj: any, name: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): /*elided*/ any;
@@ -93,9 +93,9 @@ export class Collection extends Collection_base {
9393
* Models or raw JavaScript objects to be converted to Models, or any
9494
* combination of the two.
9595
*@param {Model[]|Model|Attributes|Attributes[]} models
96-
*@param {Options} options
96+
*@param {Options} [options]
9797
*/
98-
add(models: Model[] | Model | Attributes | Attributes[], options: Options): any;
98+
add(models: Model[] | Model | Attributes | Attributes[], options?: Options): any;
9999
/**
100100
* Remove a model, or a list of models from the set.
101101
* @param {Model|Model[]} models

src/types/collection.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/types/element.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare const ElementView_base: {
88
listenTo(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
99
_listeningTo: {};
1010
_listenId: any;
11-
off(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
11+
off(name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
1212
stopListening(obj?: any, name?: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;
1313
once(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context: any): /*elided*/ any;
1414
listenToOnce(obj: any, name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any): /*elided*/ any;

src/types/eventemitter.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ export function EventEmitter<ClassConstructor extends new (...args: any[]) => {}
4545
* callbacks for the event. If `name` is null, removes all bound
4646
* callbacks for all events.
4747
* @param {string} name
48-
* @param {EventCallback} callback
48+
* @param {EventCallback} [callback]
4949
* @param {any} [context]
5050
* @return {EventEmitter}
5151
*/
52-
off(name: string, callback: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
52+
off(name: string, callback?: (event: any, model: import("./model.js").Model, collection: import("./collection.js").Collection, options?: Record<string, any>) => any, context?: any): /*elided*/ any;
5353
/**
5454
* Tell this object to stop listening to either specific events ... or
5555
* to every object it's currently listening to.

src/types/eventemitter.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/types/model.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ declare const Model_base: {
1010
listenTo(obj: any, name: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;
1111
_listeningTo: {};
1212
_listenId: any;
13-
off(name: string, callback: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
13+
off(name: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context?: any): /*elided*/ any;
1414
stopListening(obj?: any, name?: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;
1515
once(name: string, callback: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any, context: any): /*elided*/ any;
1616
listenToOnce(obj: any, name: string, callback?: (event: any, model: Model, collection: import("./collection.js").Collection, options: Record<string, any>) => any): /*elided*/ any;

0 commit comments

Comments
 (0)