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

Fix generics inference of useFilter #285

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Fix generics inference of useFilter #285

merged 3 commits into from
Sep 20, 2023

Conversation

devgioele
Copy link
Contributor

  • fix generics of useFilter using currying
  • move useFilter to components/filter

@devgioele devgioele self-assigned this Sep 19, 2023
@devgioele devgioele requested a review from lukasvice September 19, 2023 09:10
@github-actions
Copy link

Preview link: https://285.react-ui.aboutbits.dev

const searchFilterProps = useFilter<HTMLInputElement>(
const searchFilterProps = useFilter<HTMLInputElement>()(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I prefer the previous notation. Is this necessary for correct type inference? Is there no other way?

Copy link
Contributor Author

@devgioele devgioele Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find another way for correct type inference. I am open to suggestions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currying allows us to specify TElement but still inferring TValue correctly

@devgioele devgioele requested a review from lukasvice September 19, 2023 12:59
@devgioele devgioele merged commit 61b7e31 into main Sep 20, 2023
3 checks passed
@devgioele devgioele deleted the improve-filter branch September 20, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants