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

fix(types): RelayEnvironmentProvider should accept IEnvironment #266

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

ianobermiller
Copy link
Contributor

RelayEnvironmentProvider current accepts only the type Environment, which is actually the default export, or RelayModernEnvironment. Because of some funny naming by relay-runtime, we actually want "any environment", which is IEnvironment. This allows us to pass in a mock environment as opposed to a fully-fledged RelayModernEnvironment.

I also converted the component to a function for consistency and removed the generic since it isn't necessary.

@morrys
Copy link
Member

morrys commented Jan 11, 2024

hi @ianobermiller,
I'm sorry if I only replied now because I hadn't seen the pr :/

How about changing it like this?

export const RelayEnvironmentProvider = function <TEnvironment extends IEnvironment = Environment>(props: {

So the extends is the only thing that changes, this should solve your problem too.

@ianobermiller
Copy link
Contributor Author

Yes, that would work, but the generic isn't necessary since there are no other props using it.

@morrys morrys merged commit 6b1115a into relay-tools:master Jan 15, 2024
1 check passed
@morrys
Copy link
Member

morrys commented Jan 17, 2024

released with relay-hooks v9.0.0

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

Successfully merging this pull request may close these issues.

None yet

2 participants