[flow] enable enforce_local_inference_annotations (#25921)

This setting is an incremental path to the next Flow version enforcing
type annotations on most functions (except some inline callbacks).

Used
```
node_modules/.bin/flow codemod annotate-functions-and-classes --write .
```
to add a majority of the types with some hand cleanup when for large
inferred objects that should just be `Fiber` or weird constructs
including `any`.

Suppressed the remaining issues.

Builds on #25918
This commit is contained in:
Jan Kassens
2023-01-09 15:46:48 -05:00
committed by GitHub
parent 0b974418c9
commit 0b4f443020
144 changed files with 689 additions and 371 deletions
@@ -10,19 +10,19 @@
import * as React from 'react';
import {Fragment} from 'react';
function wrapWithHoc(Component, index) {
function wrapWithHoc(Component: () => any, index: number) {
function HOC() {
return <Component />;
}
const displayName = Component.displayName || Component.name;
const displayName = (Component: any).displayName || Component.name;
// $FlowFixMe[incompatible-type] found when upgrading Flow
HOC.displayName = `withHoc${index}(${displayName})`;
return HOC;
}
function wrapWithNested(Component, times) {
function wrapWithNested(Component: () => any, times: number) {
for (let i = 0; i < times; i++) {
Component = wrapWithHoc(Component, i);
}