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

Some EuiSearchBar TypeScript issues #3138

Closed
4 tasks
bevacqua opened this issue Mar 20, 2020 · 1 comment · Fixed by #3147
Closed
4 tasks

Some EuiSearchBar TypeScript issues #3138

bevacqua opened this issue Mar 20, 2020 · 1 comment · Fixed by #3147
Assignees

Comments

@bevacqua
Copy link
Contributor

  • EuiSearchBarProps['box'] doesn't understand disabled, but it's valid — we forward extra props to EuiFieldSearch but don't specify that in the types
  • Where do I get FilterConfig from? It's a type we use pervasively in Cloud UI but there doesn't seem to be a simple way to access it
  • Similar ask about EuiSearchBar['filters'], we'd like this to be exposed as a top level export
  • FilterConfig doesn't seem to understand autoClose, but I'm almost certain this is a supported feature as we've had it for a long time in Cloud UI
@bevacqua
Copy link
Contributor Author

One more, but this one needs a bit of lead up explanation. These are the types we had in Cloud UI:

export type FilterOptionValue = {
  name?: string
  field?: string
  view?: ReactNode
  value?: string | null
}

type DeferredFilterOption = () => Promise<FilterOptionValue[]>

type FilterOptions = FilterOptionValue[] | DeferredFilterOption

export type Filter = {
  name?: string
  type: 'field_value_selection' | 'field_value_toggle_group'
  field?: string
  filterWith?: 'includes'
  multiSelect?: 'or' | 'and' | boolean
  autoClose?: boolean
  loadingMessage?: string
  options?: FilterOptions
  items?: FilterOptions
}

Now that we replaced Filter[] from the code above with EuiSearchBarProps['filters'], we have to get rid of FilterOptionValue, but this one was used in a few places around our codebase. So the asks here are:

  • Can EUI expose the equivalent type for FilterOptionValue?
  • Can EUI expose the equivalent type for Filter? Since going through EuiSearchBarProps['filters'] is wrong (we need to add NonNullable too in some cases) and also just annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants