From f2cbea6be8154725518a7d768dd8418d97318adf Mon Sep 17 00:00:00 2001 From: Andrea Carraro Date: Mon, 11 Dec 2023 16:13:37 +0100 Subject: [PATCH] refactor: minor improvements (#218) * refactor: minor improvements * test: review namings --- README.md | 7 +- ....js.snap => bundles-snapshot.test.ts.snap} | 0 ...pshot.test.js => bundles-snapshot.test.ts} | 0 package.json | 2 +- src/__tests__/createCachedSelector.test.ts | 186 +++++----- src/index.d.ts | 320 +++++++++--------- 6 files changed, 263 insertions(+), 252 deletions(-) rename jest/__snapshots__/{bundles-snapshot.test.js.snap => bundles-snapshot.test.ts.snap} (100%) rename jest/{bundles-snapshot.test.js => bundles-snapshot.test.ts} (100%) diff --git a/README.md b/README.md index 3c83e6f0..dc083bf1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Npm downloads][npm-downloads-badge]][npm] [![Test coverage report][coveralls-badge]][coveralls] -From [v5](https://github.com/reduxjs/reselect/releases/tag/v5.0.1), `reselect` provides options to implement natively you custom memoization caching solution via `createSelector` options. Most of the features `re-reselect` used to enable should be now available natively in `reselect`. `re-reselect` will try to support `reselect` v5+ for backward compatibility reasons. +From [v5](https://github.com/reduxjs/reselect/releases/tag/v5.0.1), `reselect` provides the ability to natively implement custom memoization/caching solutions via `createSelector` options. Most of the features `re-reselect` used to enable should be now natively available in `reselect`. `re-reselect` will try to support `reselect` v5+ for backward compatibility reasons. `re-reselect` is a lightweight wrapper around **[Reselect][reselect]** meant to enhance selectors with **deeper memoization** and **cache management**. @@ -455,8 +455,9 @@ Get `keySelector` for utility compositions or testing. ## Todo's -- Improve TS tests readability -- More examples +- Improve tests readability +- Port to native TS based on reselect v5 approach +- Find out whether `re-reselect` should be deprecated in favour of `reselect` memoization/cache options ## Contributors diff --git a/jest/__snapshots__/bundles-snapshot.test.js.snap b/jest/__snapshots__/bundles-snapshot.test.ts.snap similarity index 100% rename from jest/__snapshots__/bundles-snapshot.test.js.snap rename to jest/__snapshots__/bundles-snapshot.test.ts.snap diff --git a/jest/bundles-snapshot.test.js b/jest/bundles-snapshot.test.ts similarity index 100% rename from jest/bundles-snapshot.test.js rename to jest/bundles-snapshot.test.ts diff --git a/package.json b/package.json index 542c7f64..77dd758f 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "test:typescript": "tsc --noEmit", "test:bundles": "npm run test:bundles:snapshot && npm run test:bundles:unit", "test:bundles:unit": "jest ./src --config ./jest/es.config.js && jest ./src --config ./jest/cjs.config.js && jest ./src --config ./jest/umd.config.js", - "test:bundles:snapshot": "jest ./jest/bundles-snapshot.test.js", + "test:bundles:snapshot": "jest ./jest/bundles-snapshot.test.ts", "test:source": "npm run test:typescript && npm run test -- --coverage", "test:update": "npm run compile && npm run test:bundles:snapshot -- -u", "clean": "rimraf dist", diff --git a/src/__tests__/createCachedSelector.test.ts b/src/__tests__/createCachedSelector.test.ts index dcb70675..138045cd 100644 --- a/src/__tests__/createCachedSelector.test.ts +++ b/src/__tests__/createCachedSelector.test.ts @@ -1,9 +1,5 @@ import * as reselect from 'reselect'; -import createCachedSelectorAsDefault, { - createCachedSelector, - FlatObjectCache, - ICacheObject, -} from '../index'; +import {createCachedSelector, FlatObjectCache, ICacheObject} from '../index'; // Cannot natively spyOn es module named exports jest.mock('reselect', () => ({ @@ -16,73 +12,15 @@ const consoleWarnSpy = jest .spyOn(global.console, 'warn') .mockImplementation(() => {}); -function selectorWithMockedResultFunc() { - return createCachedSelector([(arg1: string, arg2: string) => null], () => {})( - (arg1, arg2) => arg2 // keySelector - ); -} - describe('createCachedSelector', () => { - describe('options', () => { - describe('as single function', () => { - it('accepts keySelector function', () => { - const keySelectorMock = () => {}; - const cachedSelector = createCachedSelector( - () => {}, - () => {} - )(keySelectorMock); - - expect(cachedSelector.keySelector).toBe(keySelectorMock); - }); - }); - - describe('as single object', () => { - it('accepts keySelector, cacheObject and selectorCreator options', () => { - const cachedSelector = createCachedSelector( - (arg1: string, arg2: string) => null, - () => {} - )({ - keySelector: (arg1, arg2) => arg2, - cacheObject: new FlatObjectCache(), - selectorCreator: reselect.createSelector, - }); - - expect(cachedSelector.recomputations()).toBe(0); - cachedSelector('foo', 'bar'); - cachedSelector('foo', 'bar'); - expect(cachedSelector.recomputations()).toBe(1); - }); - - it('accepts keySelectorCreator option', () => { - const inputSelector = () => {}; - const resultFunc = () => {}; - const keySelector = () => {}; - const generatedKeySelector = () => {}; - const keySelectorCreatorMock = jest.fn(() => generatedKeySelector); - - const cachedSelector = createCachedSelector( - inputSelector, - resultFunc - )({ - keySelector, - keySelectorCreator: keySelectorCreatorMock, - }); - - expect(keySelectorCreatorMock).toHaveBeenCalledWith({ - inputSelectors: [inputSelector], - resultFunc: resultFunc, - keySelector: keySelector, - }); - expect(cachedSelector.keySelector).toBe(generatedKeySelector); - }); - }); - }); - describe('created selector', () => { describe('cache retention', () => { describe('calls producing identical cacheKey', () => { it('creates and use the same cached selector', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); cachedSelector('foo', 'bar'); cachedSelector('foo', 'bar'); @@ -93,7 +31,10 @@ describe('createCachedSelector', () => { describe('calls producing 2 different cacheKey', () => { it('creates 2 selectors only and produce 2 recomputations', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); cachedSelector('foo', 'bar'); cachedSelector('foo', 'moo'); cachedSelector('foo', 'bar'); @@ -121,7 +62,7 @@ describe('createCachedSelector', () => { () => {}, () => {} )({ - keySelector: arg1 => arg1, + keySelector: state => state, cacheObject: cacheObjectMock, }); @@ -143,7 +84,7 @@ describe('createCachedSelector', () => { () => {}, () => {} )({ - keySelector: arg1 => arg1, + keySelector: state => state, cacheObject: cacheObjectMock, }); @@ -155,7 +96,7 @@ describe('createCachedSelector', () => { }); describe('returns false', () => { - it('returns "undefined" and call "console.warn"', () => { + it('returns "undefined" and calls "console.warn"', () => { const cacheObjectMock = new FlatObjectCache(); cacheObjectMock.isValidCacheKey = () => false; cacheObjectMock.get = jest.fn(); @@ -164,7 +105,7 @@ describe('createCachedSelector', () => { () => {}, () => {} )({ - keySelector: arg1 => arg1, + keySelector: state => state, cacheObject: cacheObjectMock, }); @@ -182,9 +123,9 @@ describe('createCachedSelector', () => { describe('getMatchingSelector()', () => { it('returns underlying reselect selector for a given cache key', () => { const cachedSelector = createCachedSelector( - (arg1: string, arg2: number) => {}, + (state: string, param1: number) => {}, () => {} - )((arg1, arg2) => arg2); + )((state, param1) => param1); // Retrieve result from re-reselect cached selector const actualResult = cachedSelector('foo', 1); @@ -197,7 +138,10 @@ describe('createCachedSelector', () => { }); it('returns "undefined" when given cache key doesn\'t match any cache entry', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); const actual = cachedSelector.getMatchingSelector( 'foo', @@ -211,7 +155,10 @@ describe('createCachedSelector', () => { describe('removeMatchingSelector()', () => { it('sets the matching cache entry to "undefined"', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); cachedSelector('foo', 'bar'); // add to cache cachedSelector('foo', 'moo'); // add to cache @@ -233,7 +180,10 @@ describe('createCachedSelector', () => { describe('clearCache()', () => { it('resets cache', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); cachedSelector('foo', 'bar'); // add to cache cachedSelector.clearCache(); @@ -245,7 +195,10 @@ describe('createCachedSelector', () => { describe('resetRecomputations()', () => { it('resets recomputations', () => { - const cachedSelector = selectorWithMockedResultFunc(); + const cachedSelector = createCachedSelector( + [(state: string, param1: string) => null], + () => {} + )({keySelector: (state, param1) => param1}); cachedSelector('foo', 'bar'); expect(cachedSelector.recomputations()).toBe(1); @@ -257,17 +210,17 @@ describe('createCachedSelector', () => { describe('"dependencies" property', () => { it('exports an array containing provided inputSelectors', () => { type State = {a: string}; - const dependency1 = (state: State) => state.a; - const dependency2 = (state: State) => state.a; + const inputSelector1 = (state: State) => state.a; + const inputSelector2 = (state: State) => state.a; const cachedSelector = createCachedSelector( - dependency1, - dependency2, + inputSelector1, + inputSelector2, () => {} - )(arg1 => arg1); + )(state => state); const actual = cachedSelector.dependencies; - const expected = [dependency1, dependency2]; + const expected = [inputSelector1, inputSelector2]; expect(actual).toEqual(expected); }); }); @@ -275,9 +228,9 @@ describe('createCachedSelector', () => { describe('"resultFunc" property', () => { it('points to provided result function', () => { const resultFunc = () => {}; - const cachedSelector = createCachedSelector(() => {}, resultFunc)( - (arg1, arg2) => arg2 - ); + const cachedSelector = createCachedSelector(() => {}, resultFunc)({ + keySelector: (state, param1) => param1, + }); expect(cachedSelector.resultFunc).toBe(resultFunc); }); }); @@ -289,7 +242,7 @@ describe('createCachedSelector', () => { () => {}, () => {} )({ - keySelector: arg1 => arg1, + keySelector: state => state, cacheObject: currentCacheObject, }); @@ -309,4 +262,61 @@ describe('createCachedSelector', () => { }); }); }); + + describe('options', () => { + describe('as single function', () => { + it('accepts keySelector function', () => { + const keySelectorMock = () => {}; + const cachedSelector = createCachedSelector( + () => {}, + () => {} + )(keySelectorMock); + + expect(cachedSelector.keySelector).toBe(keySelectorMock); + }); + }); + + describe('as single object', () => { + it('accepts keySelector, cacheObject and selectorCreator options', () => { + const cachedSelector = createCachedSelector( + (state: string, param1: string) => null, + () => {} + )({ + keySelector: (state, param1) => param1, + cacheObject: new FlatObjectCache(), + selectorCreator: reselect.createSelector, + }); + + expect(cachedSelector.recomputations()).toBe(0); + cachedSelector('foo', 'bar'); + cachedSelector('foo', 'bar'); + expect(cachedSelector.recomputations()).toBe(1); + }); + + describe('"keySelectorCreator" option', () => { + it('overrides "keySelector" with provided function result', () => { + const inputSelector = () => {}; + const resultFunc = () => {}; + const keySelector = () => {}; + const generatedKeySelector = () => {}; + const keySelectorCreatorMock = jest.fn(() => generatedKeySelector); + + const cachedSelector = createCachedSelector( + inputSelector, + resultFunc + )({ + keySelector, + keySelectorCreator: keySelectorCreatorMock, + }); + + expect(keySelectorCreatorMock).toHaveBeenCalledWith({ + inputSelectors: [inputSelector], + resultFunc: resultFunc, + keySelector: keySelector, + }); + expect(cachedSelector.keySelector).toBe(generatedKeySelector); + }); + }); + }); + }); }); diff --git a/src/index.d.ts b/src/index.d.ts index 2ff190ea..54110e62 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -140,7 +140,7 @@ declare function createCachedSelector( [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -172,7 +172,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -193,7 +193,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -213,7 +213,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -236,7 +236,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -258,7 +258,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -291,7 +291,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -323,7 +323,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -368,7 +368,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -412,7 +412,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -461,7 +461,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -476,7 +476,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -522,7 +522,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -539,7 +539,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selector1: Selector, selector2: Selector, @@ -588,7 +588,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -604,7 +604,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -654,7 +654,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -672,7 +672,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selector1: Selector, selector2: Selector, @@ -725,7 +725,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -742,7 +742,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -796,7 +796,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -815,7 +815,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selector1: Selector, selector2: Selector, @@ -872,7 +872,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -890,7 +890,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -948,7 +948,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1007,7 +1007,7 @@ declare function createCachedSelector( selectors: [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3) => T ): OutputParametricCachedSelector< @@ -1018,7 +1018,7 @@ declare function createCachedSelector( [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1028,7 +1028,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4) => T ): OutputCachedSelector< @@ -1042,7 +1042,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4) => T ): OutputParametricCachedSelector< @@ -1054,7 +1054,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1065,7 +1065,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5) => T ): OutputCachedSelector< @@ -1077,7 +1077,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -1086,7 +1086,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5) => T ): OutputParametricCachedSelector< @@ -1099,7 +1099,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1111,7 +1111,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5, res6: R6) => T ): OutputCachedSelector< @@ -1124,7 +1124,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -1134,7 +1134,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5, res6: R6) => T ): OutputParametricCachedSelector< @@ -1148,7 +1148,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1161,7 +1161,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1183,7 +1183,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -1194,7 +1194,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1217,7 +1217,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1231,7 +1231,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1264,7 +1264,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector( @@ -1276,7 +1276,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1310,7 +1310,7 @@ declare function createCachedSelector( ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1325,7 +1325,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1361,7 +1361,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -1376,7 +1376,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selectors: [ ParametricSelector, @@ -1387,7 +1387,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1424,7 +1424,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1441,7 +1441,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selectors: [ Selector, @@ -1453,7 +1453,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1492,7 +1492,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -1508,7 +1508,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selectors: [ ParametricSelector, @@ -1520,7 +1520,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1560,7 +1560,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1578,7 +1578,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selectors: [ Selector, @@ -1591,7 +1591,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1633,7 +1633,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -1650,7 +1650,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selectors: [ ParametricSelector, @@ -1663,7 +1663,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1706,7 +1706,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1725,7 +1725,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selectors: [ Selector, @@ -1739,7 +1739,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -1784,7 +1784,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -1802,7 +1802,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selectors: [ ParametricSelector, @@ -1816,7 +1816,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -1862,7 +1862,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1934,7 +1934,7 @@ declare function createCachedSelector( [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1964,7 +1964,7 @@ declare function createCachedSelector< R2, R3, R4, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -1980,7 +1980,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -1996,7 +1996,7 @@ declare function createCachedSelector< R3, R4, R5, - T + T, >( selector1: Selector, selector2: Selector, @@ -2013,7 +2013,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2032,7 +2032,7 @@ declare function createCachedSelector< R3, R4, R5, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2050,7 +2050,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2068,7 +2068,7 @@ declare function createCachedSelector< R4, R5, R6, - T + T, >( selector1: Selector, selector2: Selector, @@ -2087,7 +2087,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2109,7 +2109,7 @@ declare function createCachedSelector< R4, R5, R6, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2129,7 +2129,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2149,7 +2149,7 @@ declare function createCachedSelector< R5, R6, R7, - T + T, >( selector1: Selector, selector2: Selector, @@ -2178,7 +2178,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2203,7 +2203,7 @@ declare function createCachedSelector< R5, R6, R7, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2233,7 +2233,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2255,7 +2255,7 @@ declare function createCachedSelector< R6, R7, R8, - T + T, >( selector1: Selector, selector2: Selector, @@ -2296,7 +2296,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2324,7 +2324,7 @@ declare function createCachedSelector< R6, R7, R8, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2366,7 +2366,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2390,7 +2390,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selector1: Selector, selector2: Selector, @@ -2435,7 +2435,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2466,7 +2466,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2512,7 +2512,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2538,7 +2538,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selector1: Selector, selector2: Selector, @@ -2587,7 +2587,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2621,7 +2621,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2671,7 +2671,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2699,7 +2699,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selector1: Selector, selector2: Selector, @@ -2752,7 +2752,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2789,7 +2789,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -2843,7 +2843,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -2873,7 +2873,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selector1: Selector, selector2: Selector, @@ -2930,7 +2930,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -2970,7 +2970,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selector1: ParametricSelector, selector2: ParametricSelector, @@ -3028,7 +3028,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3087,7 +3087,7 @@ declare function createCachedSelector( selectors: [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3) => T ): OutputParametricCachedSelector< @@ -3098,7 +3098,7 @@ declare function createCachedSelector( [ ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3108,7 +3108,7 @@ declare function createCachedSelector( Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4) => T ): OutputCachedSelector< @@ -3130,13 +3130,13 @@ declare function createCachedSelector< R2, R3, R4, - T + T, >( selectors: [ ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4) => T ): OutputParametricCachedSelector< @@ -3148,7 +3148,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3164,14 +3164,14 @@ declare function createCachedSelector< R3, R4, R5, - T + T, >( selectors: [ Selector, Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5) => T ): OutputCachedSelector< @@ -3183,7 +3183,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3202,14 +3202,14 @@ declare function createCachedSelector< R3, R4, R5, - T + T, >( selectors: [ ParametricSelector, ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5) => T ): OutputParametricCachedSelector< @@ -3222,7 +3222,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3240,7 +3240,7 @@ declare function createCachedSelector< R4, R5, R6, - T + T, >( selectors: [ Selector, @@ -3248,7 +3248,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5, res6: R6) => T ): OutputCachedSelector< @@ -3261,7 +3261,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3283,7 +3283,7 @@ declare function createCachedSelector< R4, R5, R6, - T + T, >( selectors: [ ParametricSelector, @@ -3291,7 +3291,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5, res6: R6) => T ): OutputParametricCachedSelector< @@ -3305,7 +3305,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3325,7 +3325,7 @@ declare function createCachedSelector< R5, R6, R7, - T + T, >( selectors: [ Selector, @@ -3334,7 +3334,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -3356,7 +3356,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3381,7 +3381,7 @@ declare function createCachedSelector< R5, R6, R7, - T + T, >( selectors: [ ParametricSelector, @@ -3390,7 +3390,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -3413,7 +3413,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3435,7 +3435,7 @@ declare function createCachedSelector< R6, R7, R8, - T + T, >( selectors: [ Selector, @@ -3445,7 +3445,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -3478,7 +3478,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3506,7 +3506,7 @@ declare function createCachedSelector< R6, R7, R8, - T + T, >( selectors: [ ParametricSelector, @@ -3516,7 +3516,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -3550,7 +3550,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3574,7 +3574,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selectors: [ Selector, @@ -3585,7 +3585,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -3621,7 +3621,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3653,7 +3653,7 @@ declare function createCachedSelector< R7, R8, R9, - T + T, >( selectors: [ ParametricSelector, @@ -3664,7 +3664,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -3701,7 +3701,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3727,7 +3727,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selectors: [ Selector, @@ -3739,7 +3739,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -3778,7 +3778,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3812,7 +3812,7 @@ declare function createCachedSelector< R8, R9, R10, - T + T, >( selectors: [ ParametricSelector, @@ -3824,7 +3824,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -3864,7 +3864,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -3892,7 +3892,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selectors: [ Selector, @@ -3905,7 +3905,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -3947,7 +3947,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -3984,7 +3984,7 @@ declare function createCachedSelector< R9, R10, R11, - T + T, >( selectors: [ ParametricSelector, @@ -3997,7 +3997,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -4040,7 +4040,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -4070,7 +4070,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selectors: [ Selector, @@ -4084,7 +4084,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ], combiner: ( res1: R1, @@ -4129,7 +4129,7 @@ declare function createCachedSelector< Selector, Selector, Selector, - Selector + Selector, ] >; declare function createCachedSelector< @@ -4169,7 +4169,7 @@ declare function createCachedSelector< R10, R11, R12, - T + T, >( selectors: [ ParametricSelector, @@ -4183,7 +4183,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ], combiner: ( res1: R1, @@ -4229,7 +4229,7 @@ declare function createCachedSelector< ParametricSelector, ParametricSelector, ParametricSelector, - ParametricSelector + ParametricSelector, ] >; @@ -4260,7 +4260,7 @@ export {createCachedSelector}; export function createStructuredCachedSelector< T extends {[key: string]: (state: any) => any}, S = $Values<{[K in keyof T]: Parameters[0]}>, - R = {[K in keyof T]: ReturnType} + R = {[K in keyof T]: ReturnType}, >( selectors: T ): OutputCachedSelector< @@ -4276,7 +4276,7 @@ export function createStructuredCachedSelector< }, S = $Values<{[K in keyof T]: Parameters[0]}>, P = Exclude<$Values<{[K in keyof T]: Parameters[1]}>, undefined>, - R = {[K in keyof T]: ReturnType} + R = {[K in keyof T]: ReturnType}, >( selectors: T ): OutputParametricCachedSelector<