kibana/examples/search_examples
Anton Dosov 240c4ff15b
[react@18] More breaking type fixes (should be the last pr) (#192266)
## Summary

Part of https://github.com/elastic/kibana/issues/138222

in @types/react@18 types
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210. This PR
addresses a bunch of remaining fixes **(hopefully the last mass ping PR
like this)** The most common are:


### 1 Objects are no longer considered a valid ReactNode

In types@17 the ReactNode typing was too soft, it allowed objects and
functions being passed as ReactNode, e.g.

```
let obj: React.ReactNode = {};
let func: React.ReactNode = () => {};
```

This was by mistake, and this PR mutes most of such cases by simply
casting to a `string` or `ReactNode`.
In some cases, it is worth to follow up and address the raised issues in
a better way (see in comments)


```diff

function MyComponent() {

const error: string | Error = 'Error'

return (
  <div>
-   {error}
+   {error as string}
  </div>
)

}

```


Most common problems are related to rendering errors, where it could be
`string | Error` object rendered directly as a ReactNode. Most often it
is related to alerting framework:

```
export interface RuleFormParamsErrors {
  [key: string]: string | string[] | RuleFormParamsErrors;
}
```

Not sure if there is a better fix then casting, surely not short-term. 

### 2 More `useCallback` implicit any fixes

Follow up to https://github.com/elastic/kibana/pull/191659

### 3 `EuiSelect` doesn't have a placeholder prop 

In a couple of places, the `placeholder` prop was removed. This is
because react types were updated and `placeholder` was removed from the
base HTML element, so it highlighted places where `placeholder` prop was
redundant
2024-09-12 13:54:18 +02:00
..
common Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
public [react@18] More breaking type fixes (should be the last pr) (#192266) 2024-09-12 13:54:18 +02:00
server Adds AGPL 3.0 license (#192025) 2024-09-06 19:02:41 -06:00
kibana.jsonc [Discover] Remove usage of deprecated React rendering utilities (#181623) 2024-04-26 11:48:06 -07:00
README.md Migrates search example mountReactNode to kibana-react toMountPoint (#137633) 2022-08-01 07:52:20 -07:00
tsconfig.json [EuiProvider] Fix Data-Discover code (#183874) 2024-05-22 09:57:26 -07:00

search_examples

An awesome Kibana plugin

Small demos of search functionality.

To run this example, ensure you have data to search against (for example, the sample datasets) and start kibana with the --run-examples flag.


Development

See the kibana contributing guide for instructions setting up your development environment.