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

Relay Environment type issues when upgrading to react-relay 16.x #4657

Open
jmancherje opened this issue Mar 22, 2024 · 3 comments
Open

Relay Environment type issues when upgrading to react-relay 16.x #4657

jmancherje opened this issue Mar 22, 2024 · 3 comments

Comments

@jmancherje
Copy link
Contributor

tl;dr we are seeing Type 'RelayModernEnvironment' is not assignable to type 'Environment'. after upgrading even with code right from docs.

We are attempting to upgrade from react-relay 14.x to 16.0.0. Our dependencies are now: react-relay 16.0.0, relay-runtime 16.0.0, @types/react-relay 16.0.0, @types/relay-runtime 14.1.15, babel-plugin-relay 16.0.0, relay-compiler 16.0.0.

We are seeing Type 'RelayModernEnvironment' is not assignable to type 'Environment'. with all our uses of environment.

I simplified the case by copying this set up right from the docs for RelayEnvironmentProvider here:

image image

Because this is just passing in the environment directly from new Environment(..) as the docs show I'm not sure what the issue is with the RelayModernEnvironment vs Environment

@jmancherje
Copy link
Contributor Author

I didn't notice this before but I see this same issue came up in 2021 for different versions of relay and relay-types #3697

@jmancherje
Copy link
Contributor Author

If this is the same problem, and DefinitelyTyped hasn't been updated to support the latest relay types, does this mean people with TypeScript and relay 15/16 are not using DefinitelyTyped (or that not many people are using TS on the latest version)?

@kejistan
Copy link

kejistan commented Apr 3, 2024

It looks like you probably have two different versions of @types/relay-runtime in your node_modules.

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

No branches or pull requests

2 participants