kibana/examples/routing_example
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 [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
README.md Update Styleguide path to .mdx (#107890) 2021-08-10 13:15:43 +02:00
tsconfig.json [EuiProvider] Fix Kibana-Core code (#183873) 2024-05-23 13:19:40 -07:00

Team owner: Platform

A working example of a plugin that registers and uses multiple custom routes.

Read more: