From e1498ebe71bd418d4067bb28b8ef6a14bd9f312c Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Tue, 27 Aug 2019 03:09:15 +0200 Subject: [PATCH] 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) --- types/backbone-relational/backbone-relational-tests.ts | 7 ++++++- types/backbone-relational/index.d.ts | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/types/backbone-relational/backbone-relational-tests.ts b/types/backbone-relational/backbone-relational-tests.ts index c8b94c4029..8c8951f269 100644 --- a/types/backbone-relational/backbone-relational-tests.ts +++ b/types/backbone-relational/backbone-relational-tests.ts @@ -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')); \ No newline at end of file +alert('theirHouse.occupants=' + theirHouse.get('occupants').pluck('name')); + +BackboneRel.store.removeModelScope(window); +BackboneRel.store.addModelScope(window); +BackboneRel.store.unregister(Person); +BackboneRel.store.reset(); diff --git a/types/backbone-relational/index.d.ts b/types/backbone-relational/index.d.ts index 72494b48c7..23cf32ac1c 100644 --- a/types/backbone-relational/index.d.ts +++ b/types/backbone-relational/index.d.ts @@ -162,8 +162,11 @@ export class Store extends EventsMixin implements Events { update(model:Model):void; - unregister(model:Model, collection:Collection, options:any):void; + // tslint:disable-next-line use-default-type-parameter + unregister(type: Model | Collection | typeof Model): void; reset():void; } + +export const store: Store;