The Wayback Machine - https://web.archive.org/web/20201014113630/https://github.com/segmentio/evergreen/pull/835/
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

Fix autocomplete and combobox typing to use generic #835

Open
wants to merge 1 commit into
base: master
from

Conversation

@leesiongchan
Copy link
Contributor

@leesiongchan leesiongchan commented May 21, 2020

Use generic for item instead of any type in Autocomplete & Combobox

@mshwery mshwery requested review from akleiner2 and colinlohner Jul 6, 2020
@stale
Copy link

@stale stale bot commented Sep 4, 2020

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.

@stale stale bot added the wontfix label Sep 4, 2020
@mshwery mshwery added typescript and removed wontfix labels Sep 6, 2020
// @deprecated
defaultSelectedItem?: string

This comment has been minimized.

@akleiner2

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.