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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use $ReadOnlyArray type for connection data #228

Merged
merged 1 commit into from Sep 30, 2019

Conversation

jaroslav-kubicek
Copy link
Contributor

@jaroslav-kubicek jaroslav-kubicek commented Sep 17, 2019

Hi good people 馃憢

I would like to suggest to use more strict type for connection data - $ReadOnlyArray<T>

Why?

We define all our types for data on GraphQL server as read-only, so passing data to connectionFromArray fails on flow unless we change the type to normal array or do workaround like [...children]:

connectionFromArray<Item>(children, args);
// Cannot call `connectionFromArray` with `children` bound to `data` because read-only array type [1] is incompatible with array type [2]

With these changes, it should be possible to opt-in for $ReadOnlyArray<T> while Array<T> would still work as well.

@kassens
Copy link
Contributor

kassens commented Sep 30, 2019

Thanks!

@kassens kassens merged commit 677e6cc into graphql:master Sep 30, 2019
@jaroslav-kubicek jaroslav-kubicek deleted the use-readonly-types branch September 30, 2019 17:47
@IvanGoncharov IvanGoncharov added the PR: bug fix 馃悶 requires increase of "patch" version number label Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: bug fix 馃悶 requires increase of "patch" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants