Skip to content

Commit

Permalink
Declare collection and model constructor params optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Oct 31, 2023
1 parent 3050100 commit 88b1608
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Collection extends EventEmitter(Object) {
* Create a new **Collection**, perhaps to contain a specific type of `model`.
* If a `comparator` is specified, the Collection will maintain
* its models in sort order, as they're added and removed.
* @param {Model[]} models
* @param {CollectionOptions} options
* @param {Model[]} [models]
* @param {CollectionOptions} [options]
*/
constructor(models, options) {
super();
Expand Down
2 changes: 1 addition & 1 deletion src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Model extends EventEmitter(Object) {
* Create a new model with the specified attributes. A client id (`cid`)
* is automatically generated and assigned for you.
* @param {Attributes} attributes
* @param {ModelOptions} options
* @param {ModelOptions} [options]
*/
constructor(attributes, options) {
super();
Expand Down
10 changes: 5 additions & 5 deletions src/types/collection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ declare const Collection_base: {
* Create a new **Collection**, perhaps to contain a specific type of `model`.
* If a `comparator` is specified, the Collection will maintain
* its models in sort order, as they're added and removed.
* @param {Model[]} models
* @param {CollectionOptions} options
* @param {Model[]} [models]
* @param {CollectionOptions} [options]
*/
_listeners: {};
listenTo(obj: any, name: string, callback?: (event: any, model: Model, collection: Collection, options: Record<string, any>) => any): any;
Expand Down Expand Up @@ -46,10 +46,10 @@ export class Collection extends Collection_base {
* Create a new **Collection**, perhaps to contain a specific type of `model`.
* If a `comparator` is specified, the Collection will maintain
* its models in sort order, as they're added and removed.
* @param {Model[]} models
* @param {CollectionOptions} options
* @param {Model[]} [models]
* @param {CollectionOptions} [options]
*/
constructor(models: Model[], options: CollectionOptions, ...args: any[]);
constructor(models?: Model[], options?: CollectionOptions, ...args: any[]);
_model: any;
comparator: any;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/types/collection.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/types/model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ export class Model extends Model_base {
* Create a new model with the specified attributes. A client id (`cid`)
* is automatically generated and assigned for you.
* @param {Attributes} attributes
* @param {ModelOptions} options
* @param {ModelOptions} [options]
*/
constructor(attributes: Attributes, options: ModelOptions, ...args: any[]);
constructor(attributes: Attributes, options?: ModelOptions, ...args: any[]);
cid: any;
attributes: {};
validationError: any;
Expand Down
2 changes: 1 addition & 1 deletion src/types/model.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 88b1608

Please sign in to comment.