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

Wrong types for optional props #501

Closed
Luchanso opened this issue Jul 5, 2021 · 2 comments
Closed

Wrong types for optional props #501

Luchanso opened this issue Jul 5, 2021 · 2 comments
Milestone

Comments

@Luchanso
Copy link

Luchanso commented Jul 5, 2021

Reproduction playground

I think in this case returning OutputSelector, not OutputParametricSelector, but I couldn't figure it out why

Workaround solution - put optional props in object:

import { createSelector } from "reselect";

type Props = {
  data?: string;
}

const selector = createSelector(
  (_: any, { data }: Props) => data,
  (data) => data
);

selector(null, "hello world");
@Luchanso
Copy link
Author

Luchanso commented Jul 5, 2021

And I found second solution, but in this case second argument is required and they can be undefined

import { createSelector } from "reselect";

const selector = createSelector(
  (_: any, data: string | undefined) => data,
  (data) => data
);

selector(null, "hello world");

@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