You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had installed your demo code like you describe it and run the file react-bootstrap-typeahead/example/index.html.
It work like on your live demo!
But if I look in the code of examples/CustomFilteringExample.tsx with my VS Code there is a typescript error.
The text:
Type '((option: Option, props: any) => boolean) | string[]' is not assignable to type 'string[] | FilterByCallback | undefined'.
Type '(option: Option, props: any) => boolean' is not assignable to type 'string[] | FilterByCallback | undefined'.
Type '(option: Option, props: any) => boolean' is not assignable to type 'FilterByCallback'.
Types of parameters 'option' and 'option' are incompatible.
Type 'import("/Users/gerdmucha/projekte/wetter/cirrus23/test_typeahead/node_modules/react-bootstrap-typeahead/types/types").Option' is not assignable to type 'import("/Users/gerdmucha/projekte/wetter/cirrus23/test_typeahead/react-bootstrap-typeahead/example/src/data").Option'.
Type 'string' is not assignable to type 'Option'.ts(2322)
types.d.ts(36, 5): The expected type comes from property 'filterBy' which is declared here on type 'IntrinsicAttributes & TypeaheadComponentProps & RefAttributes'
How can I fix this?
Version v6.3.2
Steps to reproduce
Looking code of examples/CustomFilteringExample.tsx with my VS Code
The text was updated successfully, but these errors were encountered:
This is the same issue as described in #704. Basically, the Option type being used in the component doesn't accept a generic type that conforms to case-by-case data. See the discussion in the other issue, but basically it's difficult to solve "correctly" in the library itself, since that type is propagated throughout. The simplest workaround unfortunately is to do type casting or tell TS to ignore the error.
Usage questions
I had installed your demo code like you describe it and run the file react-bootstrap-typeahead/example/index.html.
It work like on your live demo!
But if I look in the code of examples/CustomFilteringExample.tsx with my VS Code there is a typescript error.
The text:
Type '((option: Option, props: any) => boolean) | string[]' is not assignable to type 'string[] | FilterByCallback | undefined'.
Type '(option: Option, props: any) => boolean' is not assignable to type 'string[] | FilterByCallback | undefined'.
Type '(option: Option, props: any) => boolean' is not assignable to type 'FilterByCallback'.
Types of parameters 'option' and 'option' are incompatible.
Type 'import("/Users/gerdmucha/projekte/wetter/cirrus23/test_typeahead/node_modules/react-bootstrap-typeahead/types/types").Option' is not assignable to type 'import("/Users/gerdmucha/projekte/wetter/cirrus23/test_typeahead/react-bootstrap-typeahead/example/src/data").Option'.
Type 'string' is not assignable to type 'Option'.ts(2322)
types.d.ts(36, 5): The expected type comes from property 'filterBy' which is declared here on type 'IntrinsicAttributes & TypeaheadComponentProps & RefAttributes'
How can I fix this?
Version v6.3.2
Steps to reproduce
Looking code of examples/CustomFilteringExample.tsx with my VS Code
The text was updated successfully, but these errors were encountered: