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

Dropdown: search prop has invalid typings #4013

Closed
charliematters opened this issue Jul 31, 2020 · 4 comments · Fixed by #4014
Closed

Dropdown: search prop has invalid typings #4013

charliematters opened this issue Jul 31, 2020 · 4 comments · Fixed by #4014

Comments

@charliematters
Copy link
Contributor

Bug Report

Steps

Use a dropdown with a default search prop

Expected Result

That it uses the default search function

Actual Result

Type 'true | ((options: DropdownItemProps[], value: string) => boolean | DropdownItemProps[])' is not assignable to type '(options: DropdownItemProps[], value: string) => boolean | DropdownItemProps[]'.
  Type 'true' is not assignable to type '(options: DropdownItemProps[], value: string) => boolean | DropdownItemProps[]'.ts(2322)

Version

1.1.0

Testcase

Before:

search?: boolean | ((options: DropdownItemProps[], value: string) => DropdownItemProps[])

After:

search?: (options: DropdownItemProps[], value: string) => DropdownItemProps[] | boolean

The new type means that you can provide a function, but that function has to return an array of options, or a boolean. Previously, you could provide a boolean (e.g. <Dropdown search />) or alternatively a function

@layershifter
Copy link
Member

@charliematters great report 👍 Would you like to create a PR to fix it?

@charliematters
Copy link
Contributor Author

I will have a go after work!

@layershifter layershifter changed the title Dropdown search prop has changed type Dropdown: search has invalid typings Jul 31, 2020
@layershifter layershifter changed the title Dropdown: search has invalid typings Dropdown: search prop has invalid typings Jul 31, 2020
@charliematters
Copy link
Contributor Author

I raised the PR but it failed at the first hurdle because I forgot to add a label, ad now I can't update it 🤦‍♂️

Anyway, it's there - let me know if it needs updating

@layershifter
Copy link
Member

I raised the PR but it failed at the first hurdle because I forgot to add a label, ad now I can't update it 🤦‍♂️

@charliematters no worries, only maintainers can manage labels as we are using them to generate changelogs.

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

Successfully merging a pull request may close this issue.

2 participants