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

[useAutocomplete] CreateFilterOptionsConfig is not optional in CreateFilterOptions #18417

Closed
2 tasks
alaumh opened this issue Nov 17, 2019 · 4 comments · Fixed by #18419
Closed
2 tasks

[useAutocomplete] CreateFilterOptionsConfig is not optional in CreateFilterOptions #18417

alaumh opened this issue Nov 17, 2019 · 4 comments · Fixed by #18419
Labels
component: autocomplete This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. typescript

Comments

@alaumh
Copy link
Contributor

alaumh commented Nov 17, 2019

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

From useAutocomplete.d.ts

export type CreateFilterOptions = (
  config: CreateFilterOptionsConfig,
) => (option: any, state: FilterOptionsState) => any[];

export const createFilterOptions: CreateFilterOptions;

From useAutocomplete.js

export function createFilterOptions(config = {}) {
 ...
}
const defaultFilterOptions = createFilterOptions();

Expected Behavior 🤔

Make CreateFilterOptionsConfig optional

export type CreateFilterOptions = (
  config?: CreateFilterOptionsConfig,
) => (option: any, state: FilterOptionsState) => any[];

export const createFilterOptions: CreateFilterOptions;

Steps to Reproduce 🕹

Steps:

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v4.?.?
React
Browser
TypeScript
etc.
@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Nov 17, 2019
@oliviertassinari
Copy link
Member

@alaumh Thank you for raising this inconsistency issue. I'm wondering. What's your use case for using createFilterOptions without any arguments (the default)? Thanks

@alaumh
Copy link
Contributor Author

alaumh commented Nov 17, 2019

@oliviertassinari Thanks for the reply. Currently no, I found this inconsistency when I was studying the source code through converting the implementation to typescript.

@oliviertassinari oliviertassinari added good first issue Great for first contributions. Enable to learn the contribution process. typescript labels Nov 17, 2019
@oliviertassinari
Copy link
Member

@alaumh Ok, I think that we should update the TypeScript definition. Do you want to handle it? :)

@alaumh
Copy link
Contributor Author

alaumh commented Nov 17, 2019

@oliviertassinari I woud love to do it, will submit a PR later. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process. typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants