Flow upgrade to 0.205.1 (#26796)
Just a small upgrade to keep us current and remove unused suppressions (probably fixed by some upgrade since). - `*` is no longer allowed and has been an alias for `any` for a while now.
Jan Kassens committed
May 9, 2023 at 10:45 UTC
fda1f0b902b527089fe5ae7b3aa573c633166ec9
21 files changed
+41
-49
package.json
+2
-2
@@ -65,8 +65,8 @@
65
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
66
"fbjs-scripts": "^3.0.1",
67
"filesize": "^6.0.1",
68
- "flow-bin": "^0.202.0",
69
- "flow-remove-types": "^2.202.0",
68
+ "flow-bin": "^0.205.1",
69
+ "flow-remove-types": "^2.205.1",
70
"glob": "^7.1.6",
71
"glob-stream": "^6.1.0",
72
"google-closure-compiler": "^20230206.0.0",
packages/react-client/src/ReactFlightReplyClient.js
-1
@@ -291,7 +291,6 @@ export function processReply(
291
// Possibly a Date, whose toJSON automatically calls toISOString
292
// $FlowFixMe[incompatible-use]
293
const originalValue = parent[key];
294
- // $FlowFixMe[method-unbinding]
294
if (originalValue instanceof Date) {
295
return serializeDateFromDateJSON(value);
296
}
packages/react-devtools-core/src/standalone.js
-1
@@ -167,7 +167,6 @@ function onDisconnected() {
167
disconnectedCallback();
168
}
169
170
-// $FlowFixMe[missing-local-annot]
170
function onError({code, message}: $FlowFixMe) {
171
safeUnmount();
172
packages/react-devtools-extensions/flow-typed/jest.js
+3
-3
@@ -11,7 +11,7 @@
11
12
/* eslint-disable no-unused-vars */
13
14
-type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
14
+type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
15
(...args: TArguments): TReturn,
16
/**
17
* An object for introspecting mock calls
@@ -626,7 +626,7 @@ interface JestExpectType {
626
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
627
* class.
628
*/
629
- toBeInstanceOf(cls: Class<*>): void;
629
+ toBeInstanceOf(cls: Class<any>): void;
630
/**
631
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
632
* nicer.
@@ -815,7 +815,7 @@ type JestObjectType = {
815
* Returns a new, unused mock function. Optionally takes a mock
816
* implementation.
817
*/
818
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
818
+ fn<TArguments: $ReadOnlyArray<any>, TReturn>(
819
implementation?: (...args: TArguments) => TReturn
820
): JestMockFn<TArguments, TReturn>,
821
/**
packages/react-devtools-extensions/src/backendManager.js
-1
@@ -16,7 +16,6 @@ import {COMPACT_VERSION_NAME} from './utils';
16
17
let welcomeHasInitialized = false;
18
19
-// $FlowFixMe[missing-local-annot]
19
function welcome(event: $FlowFixMe) {
20
if (
21
event.source !== window ||
packages/react-devtools-shared/src/backend/legacy/renderer.js
-4
@@ -244,7 +244,6 @@ export function attach(
244
parentIDStack.pop();
245
return result;
246
} catch (err) {
247
- // $FlowFixMe[incompatible-type] found when upgrading Flow
247
parentIDStack = [];
248
throw err;
249
} finally {
@@ -281,7 +280,6 @@ export function attach(
280
parentIDStack.pop();
281
return result;
282
} catch (err) {
284
- // $FlowFixMe[incompatible-type] found when upgrading Flow
283
parentIDStack = [];
284
throw err;
285
} finally {
@@ -318,7 +316,6 @@ export function attach(
316
parentIDStack.pop();
317
return result;
318
} catch (err) {
321
- // $FlowFixMe[incompatible-type] found when upgrading Flow
319
parentIDStack = [];
320
throw err;
321
} finally {
@@ -350,7 +347,6 @@ export function attach(
347
348
return result;
349
} catch (err) {
353
- // $FlowFixMe[incompatible-type] found when upgrading Flow
350
parentIDStack = [];
351
throw err;
352
} finally {
packages/react-devtools-shared/src/backend/profilingHooks.js
+4
-2
@@ -54,7 +54,10 @@ let supportsUserTiming =
54
let supportsUserTimingV3 = false;
55
if (supportsUserTiming) {
56
const CHECK_V3_MARK = '__v3';
57
- const markOptions = ({}: {startTime?: number});
57
+ const markOptions: {
58
+ detail?: mixed,
59
+ startTime?: number,
60
+ } = {};
61
Object.defineProperty(markOptions, 'startTime', {
62
get: function () {
63
supportsUserTimingV3 = true;
@@ -64,7 +67,6 @@ if (supportsUserTiming) {
67
});
68
69
try {
67
- // $FlowFixMe[extra-arg]: Flow expects the User Timing level 2 API.
70
performance.mark(CHECK_V3_MARK, markOptions);
71
} catch (error) {
72
// Ignore
packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js
-1
@@ -45,7 +45,6 @@ const resource: Resource<
45
(element: Element) => {
46
const request = inProgressRequests.get(element);
47
if (request != null) {
48
- // $FlowFixMe[incompatible-call] found when upgrading Flow
48
return request.promise;
49
}
50
packages/react-dom-bindings/src/events/DOMPluginEventSystem.js
-1
@@ -472,7 +472,6 @@ function addTrappedEventListener(
472
if (enableLegacyFBSupport && isDeferredListenerForLegacyFBSupport) {
473
const originalListener = listener;
474
// $FlowFixMe[missing-this-annot]
475
- // $FlowFixMe[definition-cycle]
475
listener = function (...p) {
476
removeEventListener(
477
targetContainer,
packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js
-1
@@ -46,7 +46,6 @@ if (document.body != null) {
46
}
47
});
48
// documentElement must already exist at this point
49
- // $FlowFixMe[incompatible-call]
49
domBodyObserver.observe(document.documentElement, {childList: true});
50
}
51
packages/react-native-renderer/src/ReactFiberConfigFabric.js
+2
-1
@@ -13,6 +13,7 @@ import {dispatchEvent} from './ReactFabricEventEmitter';
13
import {
14
DefaultEventPriority,
15
DiscreteEventPriority,
16
+ type EventPriority,
17
} from 'react-reconciler/src/ReactEventPriorities';
18
import {HostText} from 'react-reconciler/src/ReactWorkTags';
19
@@ -317,7 +318,7 @@ export function shouldSetTextContent(type: string, props: Props): boolean {
318
return false;
319
}
320
320
-export function getCurrentEventPriority(): * {
321
+export function getCurrentEventPriority(): EventPriority {
322
const currentEventPriority = fabricGetCurrentEventPriority
323
? fabricGetCurrentEventPriority()
324
: null;
packages/react-native-renderer/src/ReactFiberConfigNative.js
+7
-3
@@ -24,7 +24,10 @@ import {
24
} from './ReactNativeComponentTree';
25
import ReactNativeFiberHostComponent from './ReactNativeFiberHostComponent';
26
27
-import {DefaultEventPriority} from 'react-reconciler/src/ReactEventPriorities';
27
+import {
28
+ DefaultEventPriority,
29
+ type EventPriority,
30
+} from 'react-reconciler/src/ReactEventPriorities';
31
32
const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
33
@@ -217,9 +220,10 @@ export function getChildHostContext(
220
}
221
}
222
220
-export function getPublicInstance(instance: Instance): * {
223
+export function getPublicInstance(instance: Instance): PublicInstance {
224
// $FlowExpectedError[prop-missing] For compatibility with Fabric
225
if (instance.canonical != null && instance.canonical.publicInstance != null) {
226
+ // $FlowFixMe[incompatible-return]
227
return instance.canonical.publicInstance;
228
}
229
@@ -262,7 +266,7 @@ export function shouldSetTextContent(type: string, props: Props): boolean {
266
return false;
267
}
268
265
-export function getCurrentEventPriority(): * {
269
+export function getCurrentEventPriority(): EventPriority {
270
return DefaultEventPriority;
271
}
272
packages/react-refresh/src/ReactFreshRuntime.js
-1
@@ -657,7 +657,6 @@ export function createSignatureFunctionForTransform(): <T>(
657
// in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
658
if (!savedType) {
659
// We're in the innermost call, so this is the actual type.
660
- // $FlowFixMe[escaped-generic] discovered when updating Flow
660
savedType = type;
661
hasCustomHooks = typeof getCustomHooks === 'function';
662
}
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js
-1
@@ -270,7 +270,6 @@ module.exports = function register() {
270
$$id: {value: moduleId},
271
$$async: {value: false},
272
});
273
- // $FlowFixMe[incompatible-call] found when upgrading Flow
273
this.exports = new Proxy(clientReference, proxyHandlers);
274
}
275
packages/react-server/src/ReactFlightServer.js
-1
@@ -946,7 +946,6 @@ export function resolveModelToJSON(
946
// Possibly a Date, whose toJSON automatically calls toISOString
947
// $FlowFixMe[incompatible-use]
948
const originalValue = parent[key];
949
- // $FlowFixMe[method-unbinding]
949
if (originalValue instanceof Date) {
950
return serializeDateFromDateJSON(value);
951
}
packages/react-test-renderer/src/ReactFiberConfigTestHost.js
+5
-2
@@ -8,7 +8,10 @@
8
*/
9
10
import isArray from 'shared/isArray';
11
-import {DefaultEventPriority} from 'react-reconciler/src/ReactEventPriorities';
11
+import {
12
+ DefaultEventPriority,
13
+ type EventPriority,
14
+} from 'react-reconciler/src/ReactEventPriorities';
15
16
export type Type = string;
17
export type Props = Object;
@@ -211,7 +214,7 @@ export function createTextInstance(
214
};
215
}
216
214
-export function getCurrentEventPriority(): * {
217
+export function getCurrentEventPriority(): EventPriority {
218
return DefaultEventPriority;
219
}
220
export function shouldAttemptEagerTransition(): boolean {
packages/react/src/ReactHooks.js
-1
@@ -224,7 +224,6 @@ export function useCacheRefresh(): <T>(?() => T, ?T) => void {
224
225
export function use<T>(usable: Usable<T>): T {
226
const dispatcher = resolveDispatcher();
227
- // $FlowFixMe[not-a-function] This is unstable, thus optional
227
return dispatcher.use(usable);
228
}
229
packages/shared/ReactSerializationErrors.js
-4
@@ -164,7 +164,6 @@ export function describeObjectForErrorMessage(
164
if (typeof value === 'string') {
165
substr = value;
166
} else if (typeof value === 'object' && value !== null) {
167
- // $FlowFixMe[incompatible-call] found when upgrading Flow
167
substr = '{' + describeObjectForErrorMessage(value) + '}';
168
} else {
169
substr = '{' + describeValueForErrorMessage(value) + '}';
@@ -191,7 +190,6 @@ export function describeObjectForErrorMessage(
190
const value = array[i];
191
let substr;
192
if (typeof value === 'object' && value !== null) {
194
- // $FlowFixMe[incompatible-call] found when upgrading Flow
193
substr = describeObjectForErrorMessage(value);
194
} else {
195
substr = describeValueForErrorMessage(value);
@@ -228,7 +226,6 @@ export function describeObjectForErrorMessage(
226
typeof value === 'object' &&
227
value !== null
228
) {
231
- // $FlowFixMe[incompatible-call] found when upgrading Flow
229
substr = describeObjectForErrorMessage(value);
230
} else {
231
substr = describeValueForErrorMessage(value);
@@ -261,7 +258,6 @@ export function describeObjectForErrorMessage(
258
const value = object[name];
259
let substr;
260
if (typeof value === 'object' && value !== null) {
264
- // $FlowFixMe[incompatible-call] found when upgrading Flow
261
substr = describeObjectForErrorMessage(value);
262
} else {
263
substr = describeValueForErrorMessage(value);
packages/shared/shallowEqual.js
+1
@@ -41,6 +41,7 @@ function shallowEqual(objA: mixed, objB: mixed): boolean {
41
const currentKey = keysA[i];
42
if (
43
!hasOwnProperty.call(objB, currentKey) ||
44
+ // $FlowFixMe[incompatible-use] lost refinement of `objB`
45
!is(objA[currentKey], objB[currentKey])
46
) {
47
return false;
scripts/flow/config/flowconfig
+1
-2
@@ -32,10 +32,9 @@ untyped-type-import=error
32
[options]
33
%CI_MAX_WORKERS%
34
munge_underscores=false
35
-inference_mode=lti
35
36
# Substituted by createFlowConfig.js:
37
%REACT_RENDERER_FLOW_OPTIONS%
38
39
[version]
41
-^0.202.0
40
+^0.205.1
yarn.lock
+16
-16
@@ -8050,22 +8050,22 @@ flatted@^3.1.0:
8050
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
8051
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
8052
8053
-flow-bin@^0.202.0:
8054
- version "0.202.0"
8055
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.202.0.tgz#1e2eb221252c2ab55c997e5eb921902f3181cc4e"
8056
- integrity sha512-Yz+yNapJMWWV6Z6pZnBR+naMhFbFJbmMS8ZBQCFUHRqN1TTw7uwitYxRj8DyzLyTpcPReSAjWbWawWPsXJot3w==
8057
-
8058
-flow-parser@^0.202.0:
8059
- version "0.202.0"
8060
- resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.202.0.tgz#534178266d3ceec5368415e59990db97eece5bd0"
8061
- integrity sha512-ZiXxSIXK3zPmY3zrzCofFonM2T+/3Jz5QZKJyPVtUERQEJUnYkXBQ+0H3FzyqiyJs+VXqb/UNU6/K6sziVYdxw==
8062
-
8063
-flow-remove-types@^2.202.0:
8064
- version "2.202.0"
8065
- resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.202.0.tgz#0718ce34169148b5e61d25658f531e4236d00a62"
8066
- integrity sha512-G6shwCpTpZWSU0HtRLmE+S6zyD1otzKXo5D0jZ92OpfNHgSYIohfUSM+njYK8d2O841AIhq8H0mMYWgc/j5ySw==
8067
- dependencies:
8068
- flow-parser "^0.202.0"
8053
+flow-bin@^0.205.1:
8054
+ version "0.205.1"
8055
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.205.1.tgz#5faf24e60df8d36f4deafef20e44863c5b295315"
8056
+ integrity sha512-pGQ/ZFr9hnbhRmc+K3K1Ui9BwDivlesNEd2mZbm5pCnxEUvbbj9nXHlTD4s4qO0k+LBKYLMZzQwBVYyRUE380g==
8057
+
8058
+flow-parser@^0.205.1:
8059
+ version "0.205.1"
8060
+ resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.205.1.tgz#337464aaf027b00b2514610386cf21a5f7c94137"
8061
+ integrity sha512-+RF/e1Et6ZX2I/UG7SGAz3Z8+ulj9xKYLu5AD7Wi8H2llzncU8ZpdKfLR50pPvj4g2a/FbZWkXYL7qHc+zXJNA==
8062
+
8063
+flow-remove-types@^2.205.1:
8064
+ version "2.205.1"
8065
+ resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.205.1.tgz#76ff3ab6386e6bb9eb7eb170ce7688931a9b7e5e"
8066
+ integrity sha512-HExM8nCVx9dpNAAe7zKH45Ii+FL6ufoQAGntMdvfCtYjhTVSkaO3MfHp/r0D8qNeAwcvGBfw7+GqQtgXm/zr2g==
8067
+ dependencies:
8068
+ flow-parser "^0.205.1"
8069
pirates "^3.0.2"
8070
vlq "^0.2.1"
8071