diff --git a/src/collection.js b/src/collection.js index 14d2a42..be6d6e7 100644 --- a/src/collection.js +++ b/src/collection.js @@ -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(); diff --git a/src/model.js b/src/model.js index 1f8d594..81d9388 100644 --- a/src/model.js +++ b/src/model.js @@ -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(); diff --git a/src/types/collection.d.ts b/src/types/collection.d.ts index f6112ab..c5373c1 100644 --- a/src/types/collection.d.ts +++ b/src/types/collection.d.ts @@ -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) => any): any; @@ -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; /** diff --git a/src/types/collection.d.ts.map b/src/types/collection.d.ts.map index 4d98d12..0c12798 100644 --- a/src/types/collection.d.ts.map +++ b/src/types/collection.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"collection.d.ts","sourceRoot":"","sources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eAGC;IADC,UAAe;IAGjB;;;OAGG;IACH,mBAHW,UAAU,YACV,OAAO,SAKjB;IAED;;;;;;OAMG;IACH,qBAJW,UAAU,GAAC,KAAK,YAChB,OAAO,GACN,KAAK,CAahB;IAED;;;;OAIG;IACH,sBAHW,KAAK,EAAE,YACP,OAAO,SA0BjB;IAED;;;;OAIG;IACH,gBAFW,GAAG,WAIb;IAED;;;;OAIG;IACH,qBAHW,KAAK,YACL,OAAO,QAOjB;IAED;;;;;OAKG;IACH,yBAMC;IAED;;;;;;;;;;OAUG;IACH,sBAcC;IAjwBC,4CAAmC;CAkwBtC;sBAvzBqB,YAAY;AAg0BlC;IACE;;;;;;;OAOG;IACH,wBAHW,UAAU,gBAOpB;IAHC,wBAA6B;IAC7B,cAAiB;IACjB,eAAe;IAGjB;;;MA6BC;IAED,0BAEC;CACF"} \ No newline at end of file +{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../collection.js"],"names":[],"mappings":"sBAkBa,OAAQ,MAAM,EAAE,GAAG,CAAC;yBACpB,OAAQ,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAO,cAAc,EAAE,OAAO;gCAE9B,OAAQ,MAAM,EAAE,GAAG,CAAC;;;;sBAc/B;;;;;;WAMG;;;;;;;;;;;;AA1BL;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH;IACE;;;;;;OAMG;IACH,qBAHW,KAAK,EAAE,YACP,iBAAiB,kBAa3B;IAPoB,YAA2B;IACR,gBAAoC;IAQ5E;;OAEG;IACH,wDAEC;IAED;;OAEG;IACH,qDAEC;IARC,gDAA8B;IAmBhC;;OAEG;IACH,6BAEC;IAdD;;;;OAIG;IACH,0BAEC;IASD,kBAEC;IAED;;;OAGG;IACH,sBAAkB;IAElB;;;OAGG;IACH,mBAAe;IAEf;;;;OAIG;IACH,gBAFU,OAAO,OAMhB;IAED;;;;OAIG;IACH,aAJU,MAAM,SACN,KAAK,GAAC,UAAU,WAChB,OAAO,OAIhB;IAED;;;;;;O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AAK,WAIpC;IAED;;;OAGG;IACH,UAFW,MAAM,OAKhB;IAED;;;;;OAKG;IACH,aAHW,UAAU,SACV,OAAO,OAIjB;IAED;;;;OAIG;IACH,iBAFW,UAAU,OAIpB;IAED;;;OAGG;IACH,gBAHW,UAAU,cACV,MAAM,OAKhB;IAED;;;;;OAKG;IACH,cAFW,OAAO,QAkBjB;IANG,YAAqC;IAQzC;;;OAGG;IACH,YAFW,MAAM,OAIhB;IAED;;;;;OAKG;IACH,eAFW,OAAO,OAiBjB;IAED;;;;;;OAMG;IACH,cAHW,KAAK,GAAC,UAAU,YAChB,OAAO;;;;;;oBAqCjB;IAED;;;;;OAKG;IACH,2BAFW,OAAO,OAIjB;IAED;;;OAGG;IACH,eAFW,UAAU,OAIpB;IAED,wDAAwD;IACxD,6BAEC;IAED,2DAA2D;IAC3D,2BAEC;IAED,oEAAoE;IACpE,8BAEC;IAED;;;OAGG;IACH,eAGC;IADC,UAAe;IAGjB;;;OAGG;IACH,mBAHW,UAAU,YACV,OAAO,SAKjB;IAED;;;;;;OAMG;IACH,qBAJW,UAAU,GAAC,KAAK,YAChB,OAAO,GACN,KAAK,CAahB;IAED;;;;OAIG;IACH,sBAHW,KAAK,EAAE,YACP,OAAO,SA0BjB;IAED;;;;OAIG;IACH,gBAFW,GAAG,WAIb;IAED;;;;OAIG;IACH,qBAHW,KAAK,YACL,OAAO,QAOjB;IAED;;;;;OAKG;IACH,yBAMC;IAED;;;;;;;;;;OAUG;IACH,sBAcC;IAjwBC,4CAAmC;CAkwBtC;sBAvzBqB,YAAY;AAg0BlC;IACE;;;;;;;OAOG;IACH,wBAHW,UAAU,gBAOpB;IAHC,wBAA6B;IAC7B,cAAiB;IACjB,eAAe;IAGjB;;;MA6BC;IAED,0BAEC;CACF"} \ No newline at end of file diff --git a/src/types/model.d.ts b/src/types/model.d.ts index 1d43047..0bdd18d 100644 --- a/src/types/model.d.ts +++ b/src/types/model.d.ts @@ -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; diff --git a/src/types/model.d.ts.map b/src/types/model.d.ts.map index 456bcd0..f0c21df 100644 --- a/src/types/model.d.ts.map +++ b/src/types/model.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../model.js"],"names":[],"mappings":"yBAgBa,OAAO,iBAAiB,EAAE,UAAU;yBACpC,OAAQ,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAQ,MAAM,EAAE,GAAG,CAAC;2BAGpB,OAAQ,MAAM,EAAE,GAAG,CAAC;;;QAPjC;;;;;;;;;;;;WAYG;QAEH;;;;;WAKG;;;;;;;;;;;;;;AAnBH;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH;IACE;;;;;OAKG;IACH,wBAHW,UAAU,WACV,YAAY,kBA2BtB;IApBC,SAAmC;IACnC,eAAoB;IAGpB,qBAA2B;IAE3B,cAAqC;IAEb,gBAAoC;IAW5D,YAAiB;IAGnB;;;;OAIG;IAEH,0BAEC;IAED;;;OAGG;IAEH,wBAEC;IAED;;;OAGG;IAEH,sBAAkB;IAElB;;;OAGG;IAEH,mBAAe;IAEf;;OAEG;IACH,cAEC;IAED;;;;;OAKG;IAEH,aALW,QAAQ,GAAC,QAAQ,GAAC,OAAO,GAAC,QAAQ,GAAC,MAAM,SACzC,KAAK,WACL,OAAO,OAKjB;IAED;;;OAGG;IACH,UAFW,MAAM,OAIhB;IAED,iBAEC;IAED,gBAEC;IAED,yBAEC;IAED,2BAEC;IAED,cAEC;IAED,0BAKC;IAED,0BAKC;IAED,eAEC;IAED;;;;OAIG;IACH,UAFW,MAAM,WAIhB;IAED;;;OAGG;IACH,eAFW,UAAU,WAIpB;IAED;;;;;;;OAOG;IACH,SAJW,MAAM,MAAO,OACb,MAAM,MAAO,YACb,OAAO,gBAuEjB;IA/CC,mBAAqB;IAGnB,yBAAiD;IAqBpB,QAAoC;IAI7C,4BAAuB;IAqB/C;;;;;OAKG;IACH,YAHW,MAAM,WACN,OAAO,gBAIjB;IAED;;;OAGG;IACH,eAFW,OAAO,gBAMjB;IAED;;;;OAIG;IACH,kBAFW,MAAM,OAKhB;IAED;;;;;;;;OAQG;IACH,kCAeC;IAED;;;;OAIG;IACH,gBAFW,MAAM,OAKhB;IAED;;;OAGG;IACH,0BAEC;IAED;;;;OAIG;IACH,eAFW,OAAO,OAgBjB;IAED;;;;;;;OAOG;IACH,UAJW,MAAM,GAAC,UAAU,QACjB,MAAM,GAAC,OAAO,YACd,OAAO,OAiEjB;IAED;;;;;OAKG;IACH,kBAFW,OAAO,WA2BjB;IAED;;;;OAIG;IACH,WAKC;IAED;;;;;OAKG;IACH,YAHW,OAAO,YACP,OAAO,WAIjB;IAED;;OAEG;IACH,iBAEC;IAED;;;OAGG;IACH,kBAFW,OAAO,WAIjB;IAED;;;;;OAKG;IACH,iBAHW,UAAU,YACV,OAAO,WASjB;CACF"} \ No newline at end of file +{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../model.js"],"names":[],"mappings":"yBAgBa,OAAO,iBAAiB,EAAE,UAAU;yBACpC,OAAQ,MAAM,EAAE,GAAG,CAAC;sBAEpB,OAAQ,MAAM,EAAE,GAAG,CAAC;2BAGpB,OAAQ,MAAM,EAAE,GAAG,CAAC;;;QAPjC;;;;;;;;;;;;WAYG;QAEH;;;;;WAKG;;;;;;;;;;;;;;AAnBH;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH;IACE;;;;;OAKG;IACH,wBAHW,UAAU,YACV,YAAY,kBA2BtB;IApBC,SAAmC;IACnC,eAAoB;IAGpB,qBAA2B;IAE3B,cAAqC;IAEb,gBAAoC;IAW5D,YAAiB;IAGnB;;;;OAIG;IAEH,0BAEC;IAED;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