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

Merging two variables with same indexer does not work #8178

Closed
frontendphil opened this issue Nov 5, 2019 · 8 comments
Closed

Merging two variables with same indexer does not work #8178

frontendphil opened this issue Nov 5, 2019 · 8 comments
Labels

Comments

@frontendphil
Copy link

Flow version: 0.111

//@flow
type Indexed = { [string]: number };
const x: Indexed = {foo: 3};
const y: Indexed = {bar: 5}

const z: Indexed = {...x, ...y};

Try here

Expected behavior

I would have expected that the assignment to z works because all indexers are the same so the new variable should also work.

Actual behavior

Cannot determine a type for object literal [1]. `Indexed` [2] cannot be spread because the indexer string [3] may overwrite properties with explicit keys in a way that Flow cannot track. Can you spread `Indexed` [2] first or remove the indexer?
@jbrown215
Copy link
Contributor

on my radar. trying to fix + put out in a patch

@IvanGoncharov
Copy link

We also experience this problem in graphql-js, see:
https://github.com/graphql/graphql-js/pull/2251/files#diff-a2222d77ff884acdf97c5f295babf27c

@jbrown215
Copy link
Contributor

There's diffs up for it, but won't make it in until 113

@lydell
Copy link

lydell commented Dec 4, 2019

Just checking: This didn’t get into 113, did it?

@jbrown215
Copy link
Contributor

jbrown215 commented Dec 4, 2019 via email

@montogeek
Copy link
Contributor

Any update? Thanks!

@lukeapage
Copy link
Contributor

The tryflow link works from 0.115 and I saw something in the changelog so I think this should be closed now.

@frontendphil
Copy link
Author

I'm closing this myself since it has been fixed in the meantime.

chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 9, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 11, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 17, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 17, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 18, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Sep 18, 2020
The Flow bug in question is facebook/flow#8178; it's reportedly
fixed in Flow v0.115; we'll get v0.122 with RN v0.63 (zulip#4245).
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jan 21, 2021
These obviously didn't get fixed in the RN v0.63 upgrade, as we'd
thought they would...

It turns out that it's a very similar bug [1] to the one we
originally thought it was [2], but slightly different.
`UserPresence` is an object type with an indexer *and* an additional
property.

[1] facebook/flow#8276
[2] facebook/flow#8178
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Jan 21, 2021
These obviously didn't get fixed in the RN v0.63 upgrade, as we'd
thought they would...

It turns out that it's a very similar bug [1] to the one we
originally thought it was [2], but slightly different.
`UserPresence` is an object type with an indexer *and* an additional
property.

[1] facebook/flow#8276
[2] facebook/flow#8178
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Jan 22, 2021
These obviously didn't get fixed in the RN v0.63 upgrade, as we'd
thought they would...

It turns out that it's a very similar bug [1] to the one we
originally thought it was [2], but slightly different.
`UserPresence` is an object type with an indexer *and* an additional
property.

[1] facebook/flow#8276
[2] facebook/flow#8178
Gautam-Arora24 pushed a commit to Gautam-Arora24/zulip-mobile that referenced this issue Feb 2, 2021
These obviously didn't get fixed in the RN v0.63 upgrade, as we'd
thought they would...

It turns out that it's a very similar bug [1] to the one we
originally thought it was [2], but slightly different.
`UserPresence` is an object type with an indexer *and* an additional
property.

[1] facebook/flow#8276
[2] facebook/flow#8178
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants