-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Flow: use implicit exact object types #1961
Conversation
|
75951e2
to
e1ac84a
Compare
e1ac84a
to
75ca687
Compare
75ca687
to
f02b28f
Compare
f02b28f
to
003edce
Compare
003edce
to
d4e0634
Compare
d4e0634
to
2c6f101
Compare
2c6f101
to
d67e0eb
Compare
@adeira/devs could you please have a look at this PR draft and share your opinion/concerns? Thanks! 😎 |
I'd say let’s do this.
What exactly do you mean by this? BC within the Universe monorepo? Can it be achieved and do we even need it?
Could a new major release be the solution? |
For example, how does it behave when we publish an NPM package with this new setup and users of our package are using the old setup? I would like to know the answer before giving this PR for a proper review. I guess both of these TODOs are the same and I had the question twice without noticing. 😬
It can be a solution, yes. I'd like to check first if it's necessary though. Also, Flow usage is quite low so we probably can cut some corners. |
If I understand this correctly, when you are using the old syntax and start mixing it with the new one, you are basically using weaker types. You don't get any Flow errors. In this meaning it's backward compatible, but from DX perspective I would appreciate a big info in changelog. Major version could be that big info, on the other hand do you see any libs with Flow types doing this? |
Edit: yeah, that's pretty much correct (I missed the "when you are using the old syntax" part). If you are still using
export type A = { x: number }; // this is already "exact" type but disallowed because it would be confusing to mix different syntaxes
export type B = { x: number, ... }; // this is inexact
export type C = {| x: number |}; // this is explicitly exact and the only allowed way how to describe type "exactness" Here is what this PR changes: export type A = { x: number }; // this is the only allowed syntax for "exact" type
export type B = { x: number, ... }; // this is still inexact
export type C = {| x: number |}; // this is also exact but no longer allowed (so it's not confusing) That's why I believe that changing
This timeline makes me think that it should be fine to proceed (6 Apr 2021). |
5b65810
to
b6647ed
Compare
This change turns `NEXT_VERSION_ERROR` rules into `ERROR` rules and updates minimum required Eslint version to `>=7.23.0`. The plan is to coordinate this change with the release of implicit exact Flow types (#1961) which is the main breaking change.
b6647ed
to
45c7d46
Compare
Flow standard is now to use `{ }` for strict objects and `{ key: value, ... }` for open objects, see: facebook/relay@6fa0b0d and facebook/react-native@00cfb0f This change should be without any problems as longs as users of our NPM libraries are using Flow with `exact_by_default=true` (which is now pretty standard I'd say). Here is how object types behave before this change: ``` type A = { x: number }; // already "exact" type but disallowed because it would be confusing to mix different syntaxes type B = { x: number, ... }; // this is inexact type C = {| x: number |}; // this is explicitly exact and the only allowed way how to describe type "exactness" ``` Here is how object types behave _after_ this change: ``` type A = { x: number }; // this is the only allowed syntax for "exact" type type B = { x: number, ... }; // this is still inexact type C = {| x: number |}; // this is also exact but no longer allowed (so it's not confusing) ``` Some related (non-blocking) issues: - gajus/eslint-plugin-flowtype#467 - facebook/flow#8612
45c7d46
to
ef6d4ff
Compare
This change turns `NEXT_VERSION_ERROR` rules into `ERROR` rules and updates minimum required Eslint version to `>=7.23.0`. The plan is to coordinate this change with the release of implicit exact Flow types (#1961) which is the main breaking change.
This change turns `NEXT_VERSION_ERROR` rules into `ERROR` rules and updates minimum required Eslint version to `>=7.23.0`. The plan is to coordinate this change with the release of implicit exact Flow types (#1961) which is the main breaking change.
This change turns `NEXT_VERSION_ERROR` rules into `ERROR` rules and updates minimum required Eslint version to `>=7.23.0`. The plan is to coordinate this change with the release of implicit exact Flow types (adeira/universe#1961) which is the main breaking change. adeira-source-id: 2bca35f7709df284c10938b7f19fbf1414a1b2f7
OSS versions of FBT and Recoil are now also getting this change, see: https://github.com/search?q=%22fb-www%2Fflow-exact-by-default-object-types%22&type=commits (fbt, recoil) |
Followup after #1961 (some special types were not converted yet)
Followup after #1961 (some special types were not converted yet)
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Followup after adeira/universe#1961 (some special types were not converted yet) adeira-source-id: b2d1f91ed135188859ab31d6c6ee48cd102919a6
Flow standard is now to use
{ }
for strict objects and{ key: value, ... }
for open objects, see: facebook/relay@6fa0b0d and facebook/react-native@00cfb0fThis change should be without any problems as longs as users of our NPM libraries are using Flow with
exact_by_default=true
(which is now pretty standard I'd say).Here is how object types behave before this change:
Here is how object types behave after this change:
Some related (non-blocking) issues:
TODO: