Skip to content

Commit fbb1370

Browse files
authored
[flow] Bump flow to v0.307.1 (#36199)
## Summary Notable changes: - Only $FlowFixMe, $FlowExpectedError suppression comments are supported - All suppression comments need error code - A lot of new invalid-compare and constant-condition errors suppressed. These errors reveal potential logical bugs ## How did you test this change? `yarn flow-ci`
1 parent 43bcbf8 commit fbb1370

197 files changed

Lines changed: 977 additions & 321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎flow-typed/environments/bom.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ declare class SharedWorker extends EventTarget {
874874
declare function importScripts(...urls: Array<string | TrustedScriptURL>): void;
875875

876876
declare class WorkerGlobalScope extends EventTarget {
877+
// $FlowFixMe[incompatible-variance]
877878
self: this;
878879
location: WorkerLocation;
879880
navigator: WorkerNavigator;

‎flow-typed/environments/dom.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,7 @@ declare class HTMLCollection<+Elem: Element> {
12631263
length: number;
12641264
item(nameOrIndex?: any, optionalIndex?: any): Elem | null;
12651265
namedItem(name: string): Elem | null;
1266+
// $FlowFixMe[incompatible-variance]
12661267
[index: number | string]: Elem;
12671268
}
12681269

‎flow-typed/environments/node.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,7 @@ type http$agentOptions = {
19081908
declare class http$Agent<+SocketT = net$Socket> {
19091909
constructor(options: http$agentOptions): void;
19101910
destroy(): void;
1911+
// $FlowFixMe[incompatible-variance]
19111912
freeSockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
19121913
getName(options: {
19131914
host: string,
@@ -1917,7 +1918,9 @@ declare class http$Agent<+SocketT = net$Socket> {
19171918
}): string;
19181919
maxFreeSockets: number;
19191920
maxSockets: number;
1921+
// $FlowFixMe[incompatible-variance]
19201922
requests: {[name: string]: $ReadOnlyArray<http$ClientRequest<SocketT>>, ...};
1923+
// $FlowFixMe[incompatible-variance]
19211924
sockets: {[name: string]: $ReadOnlyArray<SocketT>, ...};
19221925
}
19231926

‎flow-typed/environments/streams.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ declare class ReadableStreamReader {
4242

4343
closed: boolean;
4444

45-
cancel(reason: string): void;
45+
cancel(reason: string): Promise<void>;
4646
read(): Promise<{
4747
value: ?any,
4848
done: boolean,

‎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.279.0",
79-
"flow-remove-types": "^2.279.0",
78+
"flow-bin": "^0.307.1",
79+
"flow-remove-types": "^2.307.1",
8080
"flow-typed": "^4.1.1",
8181
"glob": "^7.1.6",
8282
"glob-stream": "^6.1.0",

‎packages/internal-test-utils/internalAct.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
163163
throw thrownError;
164164
}
165165

166-
// $FlowFixMe[incompatible-return]
166+
// $FlowFixMe[incompatible-type]
167167
return result;
168168
} finally {
169169
const depth = actingUpdatesScopeDepth;
@@ -285,7 +285,7 @@ export async function serverAct<T>(scope: () => Thenable<T>): Thenable<T> {
285285
throw thrownError;
286286
}
287287

288-
// $FlowFixMe[incompatible-return]
288+
// $FlowFixMe[incompatible-type]
289289
return result;
290290
} finally {
291291
if (typeof process === 'object') {

‎packages/react-cache/src/LRU.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export function createLRU<T>(limit: number): LRU<T> {
115115

116116
function access(entry: Entry<T>): T {
117117
const next = entry.next;
118+
// $FlowFixMe[invalid-compare]
118119
if (next !== null) {
119120
// Entry already cached
120121
const resolvedFirst: Entry<T> = (first: any);

‎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
}

0 commit comments

Comments
 (0)