Page MenuHomePhabricator

[Flow202][keyserver][skip-ci] [21/x] Make Date subtraction explicit
ClosedPublic

Authored by ashoat on Nov 13 2023, 3:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 16, 6:09 AM
Unknown Object (File)
Mon, Dec 16, 6:09 AM
Unknown Object (File)
Mon, Dec 16, 6:08 AM
Unknown Object (File)
Mon, Dec 16, 6:00 AM
Unknown Object (File)
Sat, Dec 14, 8:21 PM
Unknown Object (File)
Mon, Dec 9, 7:45 PM
Unknown Object (File)
Mon, Dec 9, 11:55 AM
Unknown Object (File)
Mon, Dec 2, 11:40 AM
Subscribers
None

Details

Summary

The new version of Flow was printing these errors:

Error ------------------------------------------------------------------------------------- src/utils/olm-utils.js:50:10

Cannot use operator `-` with operands Date [1] and Date [2] [unsafe-arithmetic]

 [2] 31| function getLastPrekeyPublishTime(account: OlmAccount): Date {
       :
 [1] 47|   const currentDate = new Date();
     48|   const lastPrekeyPublishDate = getLastPrekeyPublishTime(account);
     49|
     50|   return currentDate - lastPrekeyPublishDate >= maxPublishedPrekeyAge;
     51| }
     52|
     53| function shouldForgetPrekey(account: OlmAccount): boolean {

Looks like they just want us to a bit more explicit, so I added the getTime() call. I got that approach from this similar discussion on the TypeScript repo.

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 D9869

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 13 2023, 3:40 PM
Harbormaster failed remote builds in B24087: Diff 33186!
This revision is now accepted and ready to land.Nov 14 2023, 8:48 AM
ashoat retitled this revision from [Flow202][keyserver] [21/x] Make Date subtraction explicit to [Flow202][keyserver][skip-ci] [21/x] Make Date subtraction explicit.Nov 19 2023, 5:09 PM
This revision was landed with ongoing or failed builds.Nov 27 2023, 3:27 PM
This revision was automatically updated to reflect the committed changes.