Flow was printing this error:
Error ---------------------------------------------------------------------------------- navigation/root-router.js:102:8 Computing object literal [1] may lead to an exponentially large number of cases to reason about because inferred union from object literal [1] | object type [2] and inferred union from object literal [1] | object type [2] are both unions. Please use at most one union type per spread to simplify reasoning about the spread result. You may be able to get rid of a union by specifying a more general type that captures all of the branches of the union. [exponential-spread] [2] 67| +state?: { +routes: $ReadOnlyArray<ResetStateRoute>, ... }, : 99| [1] 100| let newState = { 101| ...oldRoute.state, 102| ...newPartialRoute.state, 103| routes, 104| }; 105| if (_isEqual(newState)(oldRoute.state)) {
I determined that I could solve the issue by assigning the states to their own local variable and extracting the routes property from them. Flow also needed some cajoling to accept that the states were non-null.
NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.
Depends on D10021