-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Spreading identical values with properties and indexers creates errors #8276
Comments
Interestingly, this works if passed into a function, despite having the same effect. /* @flow */
export type Trie<T> = {
[string]: Trie<T>,
_?: T,
};
const x: Trie<number> = { };
const y: Trie<number> = { };
const merge = <T>(a: T, b: T) => ({ ...a, ...b });
const z: Trie<number> = merge(x, y); Test on tryflow. |
That's an unsoundness in generic checking. I have work in the pipeline that allows this, but it exposes some nastier issue somewhere else in the type checker that makes it unshippable. Specifically, it creates an error in a library definition with no references to actual source code. |
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
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
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
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
Normally, we wouldn't upgrade Flow except in the same commit as we upgrade React Native. That's because the code for a React Native release (the code in node_modules/react-native) is only guaranteed to pass type-checking with the Flow version that was used to check the code at that release. Given that this commit breaks from our normal practice, it's unsurprising to see a Flow error in a file in node_modules/react-native. Suppress type-checking in that specific file (it's just one file), noting that it's not a file that we use directly, nor does it seem likely that the suppression propagates to a type-checking lack in our own project. (The most relevant-looking site I've seen, our use of `UIManager` in src/ZulipMobile.js, still has its types after this change.) The nice thing we get in Flow v0.125 is that `$FlowIssue` and `$FlowExpectedError` are added as default suppression comments [1], which will allow us to remove the `suppress_comment` lines in our Flow config that define those. And that's desirable because `suppress_comment` has been removed from Flow in v0.127 [2], and we'll have to take that removal along with the Flow version we take with RN v0.64. Best, then, to handle as much of this change as we can before the main RN v0.64 upgrade commit. In our own code, we have to slightly relocate a suppression comment for facebook/flow#8276; so, do that. [1] https://github.com/facebook/flow/blob/master/Changelog.md#01250 [2] https://flow.org/en/docs/config/options/#toc-suppress-comment-regex
Normally, we wouldn't upgrade Flow except in the same commit as we upgrade React Native. That's because the code for a React Native release (the code in node_modules/react-native) is only guaranteed to pass type-checking with the Flow version that was used to check the code at that release. Given that this commit breaks from our normal practice, it's unsurprising to see a Flow error in a file in node_modules/react-native. Suppress type-checking in that specific file (it's just one file), noting that it's not a file that we use directly, nor does it seem likely that the suppression propagates to a type-checking lack in our own project. (The most relevant-looking site I've seen, our use of `UIManager` in src/ZulipMobile.js, still has its types after this change.) The nice thing we get in Flow v0.125 is that `$FlowIssue` and `$FlowExpectedError` are added as default suppression comments [1], which will allow us to remove the `suppress_comment` lines in our Flow config that define those. And that's desirable because `suppress_comment` has been removed from Flow in v0.127 [2], and we'll have to take that removal along with the Flow version we take with RN v0.64. Best, then, to handle as much of this change as we can before the main RN v0.64 upgrade commit. In our own code, we have to slightly relocate a suppression comment for facebook/flow#8276; so, do that. [1] https://github.com/facebook/flow/blob/master/Changelog.md#01250 [2] https://flow.org/en/docs/config/options/#toc-suppress-comment-regex
This is expected behavior that we don't change |
Similar to #8178, but with an additional property. Spreading identical values with properties and indexers creates errors.
Flow version: 0.117.0
Expected behavior
Two values with identical types should always be spreadable
Actual behavior
Error is thrown:
The text was updated successfully, but these errors were encountered: