Page MenuHomePhabricator

[Flow202][web][skip-ci] [5/x] Address missing-local-annot type errors
ClosedPublic

Authored by ashoat on Nov 8 2023, 11:33 AM.
Tags
None
Referenced Files
F3531914: D9771.id33827.diff
Wed, Dec 25, 8:19 AM
F3531908: D9771.id33161.diff
Wed, Dec 25, 8:17 AM
F3531907: D9771.id33004.diff
Wed, Dec 25, 8:17 AM
F3531572: D9771.id33096.diff
Wed, Dec 25, 7:43 AM
F3529735: D9771.diff
Tue, Dec 24, 8:59 PM
Unknown Object (File)
Fri, Dec 20, 6:07 AM
Unknown Object (File)
Mon, Dec 16, 12:50 AM
Unknown Object (File)
Wed, Dec 11, 5:01 PM
Subscribers

Details

Summary

The new version of Flow wants more annotations for function and member definitions. This diff adds all of the required annotations to the web codebase necessary to clear all missing-local-annot errors. The lib equivalent of this diff is D9697.

I also included some other changes where I type function params that were yielding other Flow errors (different from missing-local-annot).

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 D9770

Test Plan

Confirm the Flow errors go away

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Nov 8 2023, 11:44 AM
Harbormaster failed remote builds in B23919: Diff 32957!
tomek added inline comments.
web/account/traditional-login-form.react.js
50

Do we still need this invariant?

web/chat/chat-input-bar.react.js
169

According to https://flow.org/en/docs/types/arrays/#toc-array-type-shorthand-syntax

There is an alternative to the Array<T> syntax: T[]. This syntax is discouraged and may be deprecated in the future.

This revision is now accepted and ready to land.Nov 9 2023, 3:06 AM
web/account/traditional-login-form.react.js
50

Yes – currentTarget is typed based on the type param (HTMLInputElement), but target isn't because for some SyntheticEvents, the target can be an element nested within the element where is the listener is attached. This doesn't apply in our case since we're not nesting any elements inside the <input>

(I suspect we could switch these to currentTarget, but I don't have the cycles to test that change across the codebase right now)

web/chat/chat-input-bar.react.js
169

Thanks for linking – didn't know that it's discouraged. I tend to avoid it for more complicated types, but I've been using it for simple ones like string[]

Replace string[] with Array<string>

ashoat retitled this revision from [Flow202][web] [5/x] Address missing-local-annot type errors to [Flow202][web][skip-ci] [5/x] Address missing-local-annot type errors.Nov 19 2023, 5:01 PM