Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix autocomplete and combobox typing to use generic #835
Conversation
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
| // @deprecated | ||
| defaultSelectedItem?: string |
akleiner2
Sep 14, 2020
•
Contributor
@leesiongchan To not lose any of the existing type safety here, do you think we could do something like
export interface AutocompleteProps<T extends string = string> ? That way, the fallback type (if not specified) will be string, which preserves the existing behavior.
More broadly, I've been trying to think about good ways for consumers to use components that consume the generics as-is. There is support for generics in JSX, but the syntax is pretty gnarly. Maybe a class method that generates a strongly-typed instance consuming the generic type?
Curious if you have any thoughts here!
@leesiongchan To not lose any of the existing type safety here, do you think we could do something like
export interface AutocompleteProps<T extends string = string> ? That way, the fallback type (if not specified) will be string, which preserves the existing behavior.
More broadly, I've been trying to think about good ways for consumers to use components that consume the generics as-is. There is support for generics in JSX, but the syntax is pretty gnarly. Maybe a class method that generates a strongly-typed instance consuming the generic type?
Curious if you have any thoughts here!

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Use generic for
iteminstead ofanytype in Autocomplete & Combobox