Add the missing Store instance to backbone-relational (#37926)

* Add tests for backbone-relational's exported Store instance

* Add the missing store export to backbone-relational

* Fix the typing of Store.unregister in backbone-relational

* Disable use-default-type-parameter linter rule in backbone-relational

The linter gives an unwarranted error: it complains that Model is the
default type parameter of Collection on line 165, column 41 of the
index.d.ts. While it is true that the default parameter is called
Model, the type in question has been renamed to BModel in the current
module.

* Disable the linter rule in the correct way (see b1deb1c2)
This commit is contained in:
Julian Gonggrijp
2019-08-27 03:09:15 +02:00
committed by Andrew Casey
parent e4a1a6437c
commit e1498ebe71
2 changed files with 10 additions and 2 deletions

View File

@@ -109,4 +109,9 @@ alert('paul.livesIn=' + paul.get('livesIn'));
var theirHouse = new House({ id: 'house-2' });
paul.set({ 'livesIn': theirHouse });
alert('theirHouse.occupants=' + theirHouse.get('occupants').pluck('name'));
alert('theirHouse.occupants=' + theirHouse.get('occupants').pluck('name'));
BackboneRel.store.removeModelScope(window);
BackboneRel.store.addModelScope(window);
BackboneRel.store.unregister(Person);
BackboneRel.store.reset();

View File

@@ -162,8 +162,11 @@ export class Store extends EventsMixin implements Events {
update(model:Model):void;
unregister(model:Model, collection:Collection<BModel>, options:any):void;
// tslint:disable-next-line use-default-type-parameter
unregister(type: Model | Collection<Model> | typeof Model): void;
reset():void;
}
export const store: Store;