TS2786: 'RelayEnvironmentProvider' cannot be used as a JSX component.
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
The typescript types for `RelayEnvironementProvider` doesn't appear to be compatible with `@types/react@18.2.48`. React did some changes to how JSX element types are declared last year and recommended to use `ReactNode` instead of `JSX.Element` or `ReactElement`.
Trying to update to the latest version of react's types causes components that uses RelayEnviornementProvider to stop compiling with the following error:
```
TS2786: RelayEnvironmentProvider cannot be used as a JSX component.
Its type
(props: Props) => ReactElement, string | JSXElementConstructor>
is not a valid JSX element type.
Type
(props: Props) => ReactElement, string | JSXElementConstructor>
is not assignable to type
(props: any, deprecatedLegacyContext?: any) => ReactNode
Type
ReactElement, string | JSXElementConstructor>
is not assignable to type ReactNode
Property children is missing in type
ReactElement, string | JSXElementConstructor>
but required in type ReactPortal
```
I didn't provide a specific repro project as I feel this error is self explaining. I tried the glitch link but the react and relay version that are installed is very old. It's also trivial to take any existing up-to-date react project which should use RelayEnvironementProvider and install the correct version of react's types.
Contributor guide
Assessment
This issue has not been assessed yet.