Skip to content

Covariant Wrapping Types #1136

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

Merged
merged 1 commit into from
Dec 12, 2017
Merged

Covariant Wrapping Types #1136

merged 1 commit into from
Dec 12, 2017

Conversation

leebyron
Copy link
Contributor

@leebyron leebyron commented Dec 12, 2017

Semi-breaking: Those using flow should (but are not required) to change from new GraphQLList(t) and new GraphQLNonNull(t) to GraphQLList(t) and GraphQLNonNull(t)

Because class constructors are contravariant since flow/js lacks a "finally" keyword, we need to use functions to represent covariance in GraphQLList and GraphQLNonNull.

By having wrapping types be covariant, we can enable more checks and have more accurate predicates for refining types in GraphQL utilities.

**Semi-breaking: Those using flow should change from `new GraphQLList(t)` and `new GraphQLNonNull(t)` to `GraphQLList(t)` and `GraphQLNonNull(t)`**

Because class constructors are contravariant since flow/js lacks a "finally" keyword, we need to use functions to represent covariance in GraphQLList and GraphQLNonNull.

By having wrapping types be covariant, we can enable more checks and have more accurate predicates for refining types in GraphQL utilities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants