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

[EuiSearchBar] export ArgsWithQuery, ArgsWithError #4948

Closed
PhaedrusTheGreek opened this issue Jul 13, 2021 · 2 comments · Fixed by #4968
Closed

[EuiSearchBar] export ArgsWithQuery, ArgsWithError #4948

PhaedrusTheGreek opened this issue Jul 13, 2021 · 2 comments · Fixed by #4968

Comments

@PhaedrusTheGreek
Copy link
Contributor

While trying to implement the EuiSearchBar onChange method in Typescript, I found that the ArgsWithQuery | ArgsWithError types were inaccessible / not exported. Or perhaps there might be a better way to handle this that i missed.

@thompsongl
Copy link
Contributor

thompsongl commented Jul 14, 2021

Would it work to type your onChange method as EuiSearchBarProps['onChange']?

@PhaedrusTheGreek
Copy link
Contributor Author

This does work:

  onQueryBarChange:EuiSearchBarProps['onChange'] = (args)  => {

My other solution was to do this:


interface ArgsWithQuery {
  query: Query;
  queryText: string;
  error: null;
}
interface ArgsWithError {
  query: null;
  queryText: string;
  error: Error;
}

  onQueryBarChange = (args: ArgsWithQuery | ArgsWithError) => {

Although neither seems right ...

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