Semantic-ui-react: Dropdown: `search` prop has invalid typings

Created on 31 Jul 2020  ·  4Comments  ·  Source: Semantic-Org/Semantic-UI-React

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

bug good first issue

Most helpful comment

I will have a go after work!

All 4 comments

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

I will have a go after work!

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saikrishnadeep picture saikrishnadeep  ·  3Comments

AlvMF1 picture AlvMF1  ·  3Comments

mattmacpherson picture mattmacpherson  ·  3Comments

hankthewhale picture hankthewhale  ·  3Comments

KevinGorjan picture KevinGorjan  ·  3Comments