Page MenuHomePhabricator

[Flow202][lib][skip-ci] [23/23] Fix Flow issues in lib/utils/action-logger.js
ClosedPublic

Authored by ashoat on Nov 4 2023, 12:08 PM.
Tags
None
Referenced Files
F3529914: D9715.diff
Tue, Dec 24, 10:02 PM
Unknown Object (File)
Mon, Dec 16, 12:50 AM
Unknown Object (File)
Sat, Dec 14, 8:21 PM
Unknown Object (File)
Wed, Dec 11, 8:23 PM
Unknown Object (File)
Nov 25 2024, 5:11 AM
Unknown Object (File)
Oct 27 2024, 10:18 PM
Unknown Object (File)
Oct 27 2024, 10:18 PM
Unknown Object (File)
Oct 27 2024, 10:02 PM
Subscribers

Details

Summary

Flow was printing this type error:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ utils/action-logger.js:143:13

Cannot assign this.currentOtherStates[stateKey] to state[stateKey] because an index signature declaring the expected key
/ value type is missing in object literal [1]. [prop-missing]

     140│   get currentState(): Object {
 [1] 141│     const state = this.currentReduxState ? { ...this.currentReduxState } : {};
     142│     for (const stateKey in this.currentOtherStates) {
     143│       state[stateKey] = this.currentOtherStates[stateKey];
     144│     }
     145│     return state;
     146│   }

This was solved by adding a typehint to the declaration of the local variable state. While I was here, I also replaced the Object type (which is an alias to any in modern versions of Flow) with something better: { +[string]: mixed }.

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 D9714

Test Plan

Confirm the Flow errors go away

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Nov 4 2023, 12:43 PM
Harbormaster failed remote builds in B23757: Diff 32719!
This revision is now accepted and ready to land.Nov 5 2023, 11:33 AM
ashoat retitled this revision from [Flow202][lib] [23/23] Fix Flow issues in lib/utils/action-logger.js to [Flow202][lib] [23/23][skip-ci] Fix Flow issues in lib/utils/action-logger.js.Nov 19 2023, 4:56 PM
ashoat retitled this revision from [Flow202][lib] [23/23][skip-ci] Fix Flow issues in lib/utils/action-logger.js to [Flow202][lib][skip-ci] [23/23] Fix Flow issues in lib/utils/action-logger.js.
This revision was landed with ongoing or failed builds.Nov 27 2023, 3:25 PM
This revision was automatically updated to reflect the committed changes.