Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64fe791

Browse files
committed
Flow upgrade to 0.146
This upgrade made more expressions invalidate refinements. In some places this lead to a large number of suppressions that I automatically suppressed and should be followed up on when the code is touched. I think most of them might require either manual annotations or moving a value into a const to allow refinement. ghstack-source-id: a45b40a Pull Request resolved: #25410
1 parent d3c6c16 commit 64fe791

33 files changed

+138
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
6464
"fbjs-scripts": "1.2.0",
6565
"filesize": "^6.0.1",
66-
"flow-bin": "^0.145.0",
66+
"flow-bin": "^0.146.0",
6767
"glob": "^7.1.6",
6868
"glob-stream": "^6.1.0",
6969
"google-closure-compiler": "^20200517.0.0",

packages/react-devtools-core/src/editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export function launchEditor(
186186
childProcess = spawn(editor, args, {stdio: 'inherit'});
187187
}
188188
childProcess.on('error', function() {});
189+
// $FlowFixMe[incompatible-use] found when upgrading Flow
189190
childProcess.on('exit', function(errorCode) {
190191
childProcess = null;
191192
});

packages/react-devtools-shared/src/backend/profilingHooks.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ export function createProfilingHooks({
350350
);
351351
}
352352

353+
// $FlowFixMe[incompatible-use] found when upgrading Flow
353354
currentReactComponentMeasure.duration =
355+
// $FlowFixMe[incompatible-use] found when upgrading Flow
354356
getRelativeTime() - currentReactComponentMeasure.timestamp;
355357
currentReactComponentMeasure = null;
356358
}
@@ -393,7 +395,9 @@ export function createProfilingHooks({
393395
);
394396
}
395397

398+
// $FlowFixMe[incompatible-use] found when upgrading Flow
396399
currentReactComponentMeasure.duration =
400+
// $FlowFixMe[incompatible-use] found when upgrading Flow
397401
getRelativeTime() - currentReactComponentMeasure.timestamp;
398402
currentReactComponentMeasure = null;
399403
}
@@ -438,7 +442,9 @@ export function createProfilingHooks({
438442
);
439443
}
440444

445+
// $FlowFixMe[incompatible-use] found when upgrading Flow
441446
currentReactComponentMeasure.duration =
447+
// $FlowFixMe[incompatible-use] found when upgrading Flow
442448
getRelativeTime() - currentReactComponentMeasure.timestamp;
443449
currentReactComponentMeasure = null;
444450
}
@@ -481,7 +487,9 @@ export function createProfilingHooks({
481487
);
482488
}
483489

490+
// $FlowFixMe[incompatible-use] found when upgrading Flow
484491
currentReactComponentMeasure.duration =
492+
// $FlowFixMe[incompatible-use] found when upgrading Flow
485493
getRelativeTime() - currentReactComponentMeasure.timestamp;
486494
currentReactComponentMeasure = null;
487495
}
@@ -526,7 +534,9 @@ export function createProfilingHooks({
526534
);
527535
}
528536

537+
// $FlowFixMe[incompatible-use] found when upgrading Flow
529538
currentReactComponentMeasure.duration =
539+
// $FlowFixMe[incompatible-use] found when upgrading Flow
530540
getRelativeTime() - currentReactComponentMeasure.timestamp;
531541
currentReactComponentMeasure = null;
532542
}

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ export function attach(
13101310
const id = getFiberIDThrows(fiber);
13111311
const contexts = getContextsForFiber(fiber);
13121312
if (contexts !== null) {
1313+
// $FlowFixMe[incompatible-use] found when upgrading Flow
13131314
idToContextsMap.set(id, contexts);
13141315
}
13151316
}
@@ -1380,8 +1381,10 @@ export function attach(
13801381
function getContextChangedKeys(fiber: Fiber): null | boolean | Array<string> {
13811382
if (idToContextsMap !== null) {
13821383
const id = getFiberIDThrows(fiber);
1384+
// $FlowFixMe[incompatible-use] found when upgrading Flow
13831385
const prevContexts = idToContextsMap.has(id)
1384-
? idToContextsMap.get(id)
1386+
? // $FlowFixMe[incompatible-use] found when upgrading Flow
1387+
idToContextsMap.get(id)
13851388
: null;
13861389
const nextContexts = getContextsForFiber(fiber);
13871390

@@ -2636,7 +2639,9 @@ export function attach(
26362639
const {effectDuration, passiveEffectDuration} = getEffectDurations(
26372640
root,
26382641
);
2642+
// $FlowFixMe[incompatible-use] found when upgrading Flow
26392643
currentCommitProfilingMetadata.effectDuration = effectDuration;
2644+
// $FlowFixMe[incompatible-use] found when upgrading Flow
26402645
currentCommitProfilingMetadata.passiveEffectDuration = passiveEffectDuration;
26412646
}
26422647
}
@@ -3702,6 +3707,7 @@ export function attach(
37023707
id,
37033708
responseID: requestID,
37043709
type: 'full-data',
3710+
// $FlowFixMe[incompatible-return] found when upgrading Flow
37053711
value: cleanedInspectedElement,
37063712
};
37073713
}
@@ -4276,6 +4282,7 @@ export function attach(
42764282
) {
42774283
// Is this the next Fiber we should select? Let's compare the frames.
42784284
const actualFrame = getPathFrame(fiber);
4285+
// $FlowFixMe[incompatible-use] found when upgrading Flow
42794286
const expectedFrame = trackedPath[trackedPathMatchDepth + 1];
42804287
if (expectedFrame === undefined) {
42814288
throw new Error('Expected to see a frame at the next depth.');
@@ -4289,6 +4296,7 @@ export function attach(
42894296
trackedPathMatchFiber = fiber;
42904297
trackedPathMatchDepth++;
42914298
// Are we out of frames to match?
4299+
// $FlowFixMe[incompatible-use] found when upgrading Flow
42924300
if (trackedPathMatchDepth === trackedPath.length - 1) {
42934301
// There's nothing that can possibly match afterwards.
42944302
// Don't check the children.
@@ -4443,6 +4451,7 @@ export function attach(
44434451
}
44444452
return {
44454453
id: getFiberIDThrows(fiber),
4454+
// $FlowFixMe[incompatible-use] found when upgrading Flow
44464455
isFullMatch: trackedPathMatchDepth === trackedPath.length - 1,
44474456
};
44484457
}

packages/react-devtools-shared/src/devtools/views/Components/OwnersListContext.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const resource: Resource<
4545
(element: Element) => {
4646
const request = inProgressRequests.get(element);
4747
if (request != null) {
48+
// $FlowFixMe[incompatible-call] found when upgrading Flow
4849
return request.promise;
4950
}
5051

@@ -53,6 +54,7 @@ const resource: Resource<
5354
resolveFn = resolve;
5455
});
5556

57+
// $FlowFixMe[incompatible-call] found when upgrading Flow
5658
inProgressRequests.set(element, {promise, resolveFn});
5759

5860
return promise;

packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ function findHookNames(
186186
}
187187

188188
const key = getHookSourceLocationKey(hookSource);
189+
// $FlowFixMe[incompatible-call] found when upgrading Flow
189190
map.set(key, name);
190191
});
191192

packages/react-devtools-shared/src/inspectedElementMutableSource.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export function inspectElement({
137137

138138
// A path has been hydrated.
139139
// Merge it with the latest copy we have locally and resolve with the merged value.
140+
// $FlowFixMe[incompatible-type] found when upgrading Flow
140141
inspectedElement = inspectedElementCache.get(id) || null;
141142
if (inspectedElement !== null) {
142143
// Clone element
@@ -150,6 +151,7 @@ export function inspectElement({
150151
hydrateHelper(value, ((path: any): Path)),
151152
);
152153

154+
// $FlowFixMe[incompatible-call] found when upgrading Flow
153155
inspectedElementCache.set(id, inspectedElement);
154156

155157
return [inspectedElement, type];

packages/react-devtools/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ app.on('ready', function() {
4040
}
4141

4242
// https://stackoverflow.com/questions/32402327/
43+
// $FlowFixMe[incompatible-use] found when upgrading Flow
4344
mainWindow.webContents.on('new-window', function(event, url) {
4445
event.preventDefault();
4546
require('electron').shell.openExternal(url);
4647
});
4748

4849
// and load the index.html of the app.
50+
// $FlowFixMe[incompatible-use] found when upgrading Flow
4951
mainWindow.loadURL('file://' + __dirname + '/app.html'); // eslint-disable-line no-path-concat
52+
// $FlowFixMe[incompatible-use] found when upgrading Flow
5053
mainWindow.webContents.executeJavaScript(
5154
// We use this so that RN can keep relative JSX __source filenames
5255
// but "click to open in editor" still works. js1 passes project roots
@@ -55,6 +58,7 @@ app.on('ready', function() {
5558
);
5659

5760
// Emitted when the window is closed.
61+
// $FlowFixMe[incompatible-use] found when upgrading Flow
5862
mainWindow.on('closed', function() {
5963
mainWindow = null;
6064
});

packages/react-dom-bindings/src/client/ReactDOMFloatClient.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ function preinit(href: string, options: PreinitOptions) {
241241
options,
242242
);
243243
resource = createStyleResource(
244+
// $FlowFixMe[incompatible-call] found when upgrading Flow
244245
currentDocument,
245246
href,
246247
precedence,
@@ -347,6 +348,7 @@ export function getResource(
347348
} else {
348349
const resourceProps = stylePropsFromRawProps(styleRawProps);
349350
resource = createStyleResource(
351+
// $FlowFixMe[incompatible-call] found when upgrading Flow
350352
currentDocument,
351353
href,
352354
precedence,
@@ -382,6 +384,7 @@ export function getResource(
382384
} else {
383385
const resourceProps = preloadPropsFromRawProps(preloadRawProps);
384386
resource = createPreloadResource(
387+
// $FlowFixMe[incompatible-call] found when upgrading Flow
385388
currentDocument,
386389
href,
387390
resourceProps,

packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ function extractCompositionEvent(
227227
}
228228
}
229229

230+
// $FlowFixMe[incompatible-call] found when upgrading Flow
230231
const listeners = accumulateTwoPhaseListeners(targetInst, eventType);
231232
if (listeners.length > 0) {
232233
// $FlowFixMe[incompatible-type]

0 commit comments

Comments
 (0)