Skip to content

Typescript types incompatible on examplecode #847

Closed as duplicate of#704
Closed as duplicate of#704
@gmuc

Description

@gmuc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions