Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props argument types not merged correctly with overlapping keys #492

Closed
LiamMartens opened this issue Feb 18, 2021 · 2 comments
Closed

Props argument types not merged correctly with overlapping keys #492

LiamMartens opened this issue Feb 18, 2021 · 2 comments
Milestone

Comments

@LiamMartens
Copy link

LiamMartens commented Feb 18, 2021

Reselect: v4.0.0

It looks like when using the props argument in selectors, there is a typing issue when the props of 2 selectors have overlapping keys.

Consider following code

const fooPropSelector = (_: {}, ownProps: { foo: string }) => ownProps.foo;
const fooBarPropsSelector = (_: {}, ownProps: { foo: string; bar: string; }) => [ownProps.foo, ownProps.bar];
const combinedSelector = createSelector(
  fooPropSelector,
  fooBarPropsSelector,
  (foo, fooBar) => fooBar
);

In this example the type of the combinedSelector results in:

OutputParametricSelector<{}, {
    foo: string;
}, string[], (res1: string, res2: string[]) => string[]>

Whereas it should be

OutputParametricSelector<{}, {
    foo: string;
    bar: string;
}, string[], (res1: string, res2: string[]) => string[]>
@markerikson
Copy link
Contributor

I just published https://github.com/reduxjs/reselect/releases/tag/v4.1.0-alpha.0 , which rewrites the TS types. Can you see if that works better for you?

@markerikson markerikson added this to the 4.1 milestone Oct 17, 2021
@markerikson
Copy link
Contributor

Should be fixed by #486 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants