Skip to content

Commit 00b49e3

Browse files
committed
[flow] Upgrade from 0.280 -> 0.281
Major changes in Flow 0.281: - $FlowFixMe comments now require explicit error codes (e.g., $FlowFixMe[incompatible-type]) - Changed all bare $FlowFixMe to include appropriate error codes - Changed $FlowIgnore to $FlowFixMe where needed - Fixed stream types to have cancel() return Promise<void> instead of void - Added pseudoElement property to KeyframeEffect type - Added suppressions for Proxy handler variance issues - Fixed various type errors across the codebase
1 parent 76dc3c0 commit 00b49e3

39 files changed

+158
-119
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
7676
"fbjs-scripts": "^3.0.1",
7777
"filesize": "^6.0.1",
78-
"flow-bin": "^0.280.0",
79-
"flow-remove-types": "^2.280.0",
78+
"flow-bin": "^0.281.0",
79+
"flow-remove-types": "^2.281.0",
8080
"flow-typed": "^4.1.1",
8181
"glob": "^7.1.6",
8282
"glob-stream": "^6.1.0",

packages/react-client/src/ReactClientConsoleConfigBrowser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function bindToConsole(
3535
case 'groupEnd':
3636
case 'table': {
3737
// These methods cannot be colorized because they don't take a formatting string.
38-
// $FlowFixMe
38+
// $FlowFixMe[incompatible-type]
3939
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
4040
}
4141
case 'assert': {
@@ -68,6 +68,7 @@ export function bindToConsole(
6868
// The "this" binding in the "bind";
6969
newArgs.unshift(console);
7070

71-
// $FlowFixMe
71+
// $FlowFixMe[incompatible-type]
72+
// $FlowFixMe[invalid-computed-prop]
7273
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
7374
}

packages/react-client/src/ReactClientConsoleConfigPlain.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function bindToConsole(
2525
case 'groupEnd':
2626
case 'table': {
2727
// These methods cannot be colorized because they don't take a formatting string.
28-
// $FlowFixMe
28+
// $FlowFixMe[incompatible-type]
2929
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
3030
}
3131
case 'assert': {
@@ -49,6 +49,7 @@ export function bindToConsole(
4949
// The "this" binding in the "bind";
5050
newArgs.unshift(console);
5151

52-
// $FlowFixMe
52+
// $FlowFixMe[incompatible-type]
53+
// $FlowFixMe[invalid-computed-prop]
5354
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
5455
}

packages/react-client/src/ReactClientConsoleConfigServer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function bindToConsole(
3636
case 'groupEnd':
3737
case 'table': {
3838
// These methods cannot be colorized because they don't take a formatting string.
39-
// $FlowFixMe
39+
// $FlowFixMe[incompatible-type]
4040
return bind.apply(console[methodName], [console].concat(args)); // eslint-disable-line react-internal/no-production-logging
4141
}
4242
case 'assert': {
@@ -69,6 +69,7 @@ export function bindToConsole(
6969
// The "this" binding in the "bind";
7070
newArgs.unshift(console);
7171

72-
// $FlowFixMe
72+
// $FlowFixMe[incompatible-type]
73+
// $FlowFixMe[invalid-computed-prop]
7374
return bind.apply(console[methodName], newArgs); // eslint-disable-line react-internal/no-production-logging
7475
}

packages/react-client/src/ReactFlightClient.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,12 @@ ReactPromise.prototype.then = function <T>(
283283
const rejectCallback = reject;
284284
const wrapperPromise: Promise<T> = new Promise((res, rej) => {
285285
resolve = value => {
286-
// $FlowFixMe
286+
// $FlowFixMe[prop-missing]
287287
wrapperPromise._debugInfo = this._debugInfo;
288288
res(value);
289289
};
290290
reject = reason => {
291-
// $FlowFixMe
291+
// $FlowFixMe[prop-missing]
292292
wrapperPromise._debugInfo = this._debugInfo;
293293
rej(reason);
294294
};
@@ -3922,7 +3922,7 @@ function initializeDebugInfo(
39223922
}
39233923
if (debugInfo.owner == null && response._debugRootOwner != null) {
39243924
const componentInfoOrAsyncInfo: ReactComponentInfo | ReactAsyncInfo =
3925-
// $FlowFixMe: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
3925+
// $FlowFixMe[incompatible-type]: By narrowing `owner` to `null`, we narrowed `debugInfo` to `ReactComponentInfo`
39263926
debugInfo;
39273927
// $FlowFixMe[cannot-write]
39283928
componentInfoOrAsyncInfo.owner = response._debugRootOwner;
@@ -4268,7 +4268,7 @@ function logComponentInfo(
42684268
childrenEndTime: number,
42694269
isLastComponent: boolean,
42704270
): void {
4271-
// $FlowFixMe: Refined.
4271+
// $FlowFixMe[incompatible-use]: Refined.
42724272
if (
42734273
isLastComponent &&
42744274
root.status === ERRORED &&
@@ -4447,7 +4447,7 @@ function flushComponentPerformance(
44474447
if (componentEndTime > childrenEndTime) {
44484448
childrenEndTime = componentEndTime;
44494449
}
4450-
// $FlowFixMe: Refined.
4450+
// $FlowFixMe[incompatible-type]: Refined.
44514451
const componentInfo: ReactComponentInfo = candidateInfo;
44524452
logComponentInfo(
44534453
response,
@@ -4471,7 +4471,7 @@ function flushComponentPerformance(
44714471
if (endTime > childrenEndTime) {
44724472
childrenEndTime = endTime;
44734473
}
4474-
// $FlowFixMe: Refined.
4474+
// $FlowFixMe[incompatible-type]: Refined.
44754475
const asyncInfo: ReactAsyncInfo = candidateInfo;
44764476
const env = response._rootEnvironmentName;
44774477
const promise = asyncInfo.awaited.value;
@@ -4534,7 +4534,7 @@ function flushComponentPerformance(
45344534
if (componentEndTime > childrenEndTime) {
45354535
childrenEndTime = componentEndTime;
45364536
}
4537-
// $FlowFixMe: Refined.
4537+
// $FlowFixMe[incompatible-type]: Refined.
45384538
const componentInfo: ReactComponentInfo = candidateInfo;
45394539
const env = response._rootEnvironmentName;
45404540
logComponentAborted(

packages/react-client/src/ReactFlightClientStreamConfigNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function createStringDecoder(): StringDecoder {
1515
return new TextDecoder();
1616
}
1717

18-
const decoderOptions = {stream: true};
18+
const decoderOptions: {stream?: boolean, ...} = {stream: true};
1919

2020
export function readPartialStringChunk(
2121
decoder: StringDecoder,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,7 +3770,7 @@ export function attach(
37703770
start,
37713771
end,
37723772
value: promise,
3773-
// $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3773+
// $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
37743774
owner: fiber, // Allow linking to the <link> if it's not filtered.
37753775
};
37763776
if (byteSize > 0) {
@@ -3779,7 +3779,7 @@ export function attach(
37793779
}
37803780
const asyncInfo: ReactAsyncInfo = {
37813781
awaited: ioInfo,
3782-
// $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3782+
// $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
37833783
owner: fiber._debugOwner == null ? null : fiber._debugOwner,
37843784
debugStack: fiber._debugStack == null ? null : fiber._debugStack,
37853785
debugTask: fiber._debugTask == null ? null : fiber._debugTask,
@@ -3886,7 +3886,7 @@ export function attach(
38863886
start,
38873887
end,
38883888
value: promise,
3889-
// $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3889+
// $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
38903890
owner: fiber, // Allow linking to the <link> if it's not filtered.
38913891
};
38923892
if (byteSize > 0) {
@@ -3895,7 +3895,7 @@ export function attach(
38953895
}
38963896
const asyncInfo: ReactAsyncInfo = {
38973897
awaited: ioInfo,
3898-
// $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
3898+
// $FlowFixMe[incompatible-type]: This field doesn't usually take a Fiber but we're only using inside this file.
38993899
owner: fiber._debugOwner == null ? null : fiber._debugOwner,
39003900
debugStack: fiber._debugStack == null ? null : fiber._debugStack,
39013901
debugTask: fiber._debugTask == null ? null : fiber._debugTask,
@@ -6053,7 +6053,7 @@ export function attach(
60536053
function getNearestMountedDOMNode(publicInstance: Element): null | Element {
60546054
let domNode: null | Element = publicInstance;
60556055
while (domNode && !publicInstanceToDevToolsInstanceMap.has(domNode)) {
6056-
// $FlowFixMe: In practice this is either null or Element.
6056+
// $FlowFixMe[incompatible-type]: In practice this is either null or Element.
60576057
domNode = domNode.parentNode;
60586058
}
60596059
return domNode;
@@ -8807,7 +8807,7 @@ export function attach(
88078807
return (instance.source = extractLocationFromComponentStack(lastLine));
88088808
}
88098809

8810-
// $FlowFixMe: refined.
8810+
// $FlowFixMe[incompatible-return]: refined.
88118811
return unresolvedSource;
88128812
}
88138813

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,13 @@ class Bridge<
362362
this._messageQueue.push(event, payload);
363363
if (!this._scheduledFlush) {
364364
this._scheduledFlush = true;
365-
// $FlowFixMe
365+
// $FlowFixMe[cannot-resolve-name]
366366
if (typeof devtoolsJestTestScheduler === 'function') {
367367
// This exists just for our own jest tests.
368368
// They're written in such a way that we can neither mock queueMicrotask
369369
// because then we break React DOM and we can't not mock it because then
370370
// we can't synchronously flush it. So they need to be rewritten.
371-
// $FlowFixMe
371+
// $FlowFixMe[cannot-resolve-name]
372372
devtoolsJestTestScheduler(this._flush); // eslint-disable-line no-undef
373373
} else {
374374
queueMicrotask(this._flush);

packages/react-devtools-shared/src/devtools/views/Profiler/HookChangeSummary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Toggle from '../Toggle';
2727
import type {HooksNode} from 'react-debug-tools/src/ReactDebugHooks';
2828
import type {ChangeDescription} from './types';
2929

30-
// $FlowFixMe: Flow doesn't know about Intl.ListFormat
30+
// $FlowFixMe[prop-missing]: Flow doesn't know about Intl.ListFormat
3131
const hookListFormatter = new Intl.ListFormat('en', {
3232
style: 'long',
3333
type: 'conjunction',

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTreeContext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ function SuspenseTreeContextController({children}: Props): React.Node {
174174
let selectedTimelineID: null | number = null;
175175
if (selectedTimelineStep !== null) {
176176
selectedTimelineID = selectedTimelineStep.id;
177-
// $FlowFixMe
177+
// $FlowFixMe[incompatible-call]
178178
while (removedIDs.has(selectedTimelineID)) {
179-
// $FlowFixMe
179+
// $FlowFixMe[incompatible-type]
180180
selectedTimelineID = removedIDs.get(selectedTimelineID);
181181
}
182182
}

0 commit comments

Comments
 (0)