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
Unknown Object (File)
Tue, May 7, 8:18 AM
Unknown Object (File)
Thu, May 2, 3:13 PM
Unknown Object (File)
Sun, Apr 21, 11:34 PM
Unknown Object (File)
Mon, Apr 15, 4:04 PM
Unknown Object (File)
Mon, Apr 15, 12:14 AM
Unknown Object (File)
Apr 13 2024, 3:58 PM
Unknown Object (File)
Apr 12 2024, 5:01 PM
Unknown Object (File)
Apr 11 2024, 9:05 AM
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.