-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve Flow support #1844
Comments
Thank you @mgtitimoli ! When we first added Flow support, it was very initial and our experience Flow was very basic. You are right regarding the spread over intersect, and I think it will also resolve this issue: #1673 Regarding enums, we allow you now to customize the I hope we'll have some time during this month to handle these, we are currently working on adding some core features (And we always welcome PRs 😉 ). |
Hi, Code working well for flow, but have problems for other libs. This edited code is in used also in other plugins. You can check changes here: https://github.com/matikrk/graphql-code-generator/pull/1 |
Hi @matikrk! Please let me know if you need more help with that! |
I've worked a bit on it and created 2 another version of this change:
version 3 now is working |
All types in flow use spread operator. All test passing and also works well on my other project. @dotansimha If you could look on this PR https://github.com/matikrk/graphql-code-generator/pull/3 will be great If you have suggestions about naming pls let me know. Final version is here #2569 |
The initial implementation of this change was in: #2569, thanks @matikrk ! The final implementation is here: #2602 It will be available in the next release. Thanks @mgtitimoli @matikrk |
Hey there, Before moving forward I want to apologize for not being so much into this. I've checked the PR and I found 2 things that imo they should be addressed as the way they are now could create issues:
|
|
@matikrk I think we can set the default behaviour of Flow plugins to use the exact operators. It's an easy fix and shouldn't cause breaking changes.
type $Pick<Origin: Object, Keys: Object> = $ObjMapi<Keys, <Key>(k: Key) => $ElementType<Origin, Key>>; Which allow use to pick multiple fields from a type, and create a new type out of it. |
I use the same One tricky thing about it is that when you use it, type T0 = {|
k0: string,
k1: number
|};
type T1Inexact = $Pick<T0, {k1: any}>;
type T2Broken = {|...T1Inexact|};
type T1Exact = $Pick<T0, {|k1: any|}>;
type T2Fine = {|...T1Exact|}; |
Ohh I see. Thanks @mgtitimoli ! I'll do those fixes soon :) |
@mgtitimoli Fixed in: #2613 |
Fixed in 1.8.0 🚀 |
In order to improve flow support I have the following suggestions:
&
), as the latter where there are property collisions the resulting type is the intersection of all the types of that particular prop (see here)The text was updated successfully, but these errors were encountered: