HomePhabricator
Diffusion Comm 8f1dfa670de5

[Flow202][web][skip-ci] [19/x] Fix Flow issues around untyped this parameter

Description

[Flow202][web][skip-ci] [19/x] Fix Flow issues around untyped this parameter

Summary:
The new version of Flow wants us to type the this parameter in naked function declarations.

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ media/image-utils.js:20:33

Missing an annotation on implicit this parameter of function. [missing-this-annot]

     17│
     18│ function getEXIFOrientation(file: File): Promise<?number> {
     19│   return new Promise(resolve => {
     20│     EXIF.getData(file, function () {
     21│       resolve(EXIF.getTag(this, 'Orientation'));
     22│     });
     23│   });

To type this, Flow has a somewhat weird syntax where we list this as a parameter. This confuses ESLint, so I had to add an eslint-disable line as well.

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 D9784

Test Plan: Confirm the Flow errors go away

Reviewers: tomek

Reviewed By: tomek

Subscribers: wyilio

Differential Revision: https://phab.comm.dev/D9785

Details