Skip to content

Commit

Permalink
refactor: remove double arguments invocation error
Browse files Browse the repository at this point in the history
  • Loading branch information
toomuchdesign committed Dec 8, 2023
1 parent 2b6e7d6 commit 2b4b6af
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
15 changes: 0 additions & 15 deletions src/__tests__/createCachedSelector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ describe('createCachedSelector', () => {
expect(cachedSelector.keySelector).toBe(generatedKeySelector);
});
});

describe('as second argument', () => {
it('throws an error', () => {
expect(() => {
createCachedSelector(
() => {},
() => {}
)(
() => {},
// @ts-expect-error
{}
);
}).toThrow(/"options" as second argument is not supported anymore/);
});
});
});

describe('created selector', () => {
Expand Down
8 changes: 1 addition & 7 deletions src/createCachedSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ const defaultCacheCreator = FlatObjectCache;
const defaultCacheKeyValidator = () => true;

function createCachedSelector(...funcs) {
return (polymorphicOptions, legacyOptions) => {
if (legacyOptions) {
throw new Error(
'[re-reselect] "options" as second argument is not supported anymore. Please provide an option object as single argument.'
);
}

return polymorphicOptions => {
const options =
typeof polymorphicOptions === 'function'
? {keySelector: polymorphicOptions}
Expand Down

0 comments on commit 2b4b6af

Please sign in to comment.