relay
relay copied to clipboard
Relay Environment type issues when upgrading to react-relay 16.x
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:
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
I didn't notice this before but I see this same issue came up in 2021 for different versions of relay and relay-types https://github.com/facebook/relay/issues/3697
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)?
It looks like you probably have two different versions of @types/relay-runtime
in your node_modules.
Similar issue here since January: https://github.com/facebook/relay/issues/4598
Everything works fine with previous versions of @types/react.