Update Flow to 0.265 (#34270)
Looks like this version removed `Object.prototype` although I didn't see that in the changelog. This is fine for this code here.
Jan Kassens committed
Aug 22, 2025 at 15:22 UTC
d260b0d8b8452cb19dc13a3a2ef8bca6cba58d1d
8 files changed
+22
-176
flow-typed/environments/node.js
+7
-3
@@ -3236,7 +3236,7 @@ declare module 'util' {
3236
declare class TextDecoder {
3237
constructor(
3238
encoding?: string,
3239
- options: {
3239
+ options?: {
3240
fatal?: boolean,
3241
ignoreBOM?: boolean,
3242
...
@@ -3253,8 +3253,12 @@ declare module 'util' {
3253
3254
declare class TextEncoder {
3255
constructor(): void;
3256
- encode(input?: string): Uint8Array;
3257
- encoding: string;
3256
+ encode(input: string): Uint8Array;
3257
+ encodeInto(
3258
+ input: string,
3259
+ buffer: Uint8Array
3260
+ ): {written: number, read: number};
3261
+ encoding: 'utf-8';
3262
}
3263
3264
declare var types: {
package.json
+2
-2
@@ -74,8 +74,8 @@
74
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
75
"fbjs-scripts": "^3.0.1",
76
"filesize": "^6.0.1",
77
- "flow-bin": "^0.263",
78
- "flow-remove-types": "^2.263",
77
+ "flow-bin": "^0.265",
78
+ "flow-remove-types": "^2.265",
79
"flow-typed": "^4.1.1",
80
"glob": "^7.1.6",
81
"glob-stream": "^6.1.0",
packages/internal-test-utils/enqueueTask.js
+1
@@ -11,6 +11,7 @@ const {MessageChannel} = require('node:worker_threads');
11
12
export default function enqueueTask(task: () => void): void {
13
const channel = new MessageChannel();
14
+ // $FlowFixMe[prop-missing]
15
channel.port1.onmessage = () => {
16
channel.port1.close();
17
task();
packages/react-devtools-shared/src/backend/profilingHooks.js
+1
@@ -278,6 +278,7 @@ export function createProfilingHooks({
278
279
const top = currentReactMeasuresStack.pop();
280
// $FlowFixMe[incompatible-type]
281
+ // $FlowFixMe[incompatible-use]
282
if (top.type !== type) {
283
console.error(
284
'Unexpected type "%s" completed at %sms before "%s" completed.',
packages/react-reconciler/src/ReactFiberPerformanceTrack.js
-1
@@ -712,7 +712,6 @@ export function logTransitionStart(
712
const color = eventIsRepeat ? 'secondary-light' : 'warning';
713
if (__DEV__ && debugTask) {
714
debugTask.run(
715
- // $FlowFixMe[method-unbinding]
715
console.timeStamp.bind(
716
console,
717
eventIsRepeat ? '' : 'Event: ' + eventType,
packages/react-refresh/src/ReactFreshRuntime.js
+4
-2
@@ -671,8 +671,10 @@ export function isLikelyComponentType(type: any): boolean {
671
// This looks like a class.
672
return false;
673
}
674
- // eslint-disable-next-line no-proto
675
- if (type.prototype.__proto__ !== Object.prototype) {
674
+ if (
675
+ // $FlowFixMe[prop-missing]
676
+ type.prototype.__proto__ !== Object.prototype // eslint-disable-line no-proto
677
+ ) {
678
// It has a superclass.
679
return false;
680
}
scripts/flow/environment.js
+2
-163
@@ -17,83 +17,17 @@ declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
17
inject: ?((stuff: Object) => void)
18
};*/
19
20
-declare const globalThis: Object;
21
-
22
-declare const queueMicrotask: (fn: Function) => void;
20
declare const reportError: (error: mixed) => void;
24
-declare const AggregateError: Class<Error>;
25
-
26
-declare const FinalizationRegistry: any;
21
22
declare module 'create-react-class' {
23
declare const exports: $FlowFixMe;
24
}
25
32
-declare module 'error-stack-parser' {
33
- // flow-typed signature: 132e48034ef4756600e1d98681a166b5
34
- // flow-typed version: c6154227d1/error-stack-parser_v2.x.x/flow_>=v0.104.x
35
-
36
- declare interface StackFrame {
37
- constructor(object: StackFrame): StackFrame;
38
-
39
- isConstructor?: boolean;
40
- getIsConstructor(): boolean;
41
- setIsConstructor(): void;
42
-
43
- isEval?: boolean;
44
- getIsEval(): boolean;
45
- setIsEval(): void;
46
-
47
- isNative?: boolean;
48
- getIsNative(): boolean;
49
- setIsNative(): void;
50
-
51
- isTopLevel?: boolean;
52
- getIsTopLevel(): boolean;
53
- setIsTopLevel(): void;
54
-
55
- columnNumber?: number;
56
- getColumnNumber(): number;
57
- setColumnNumber(): void;
58
-
59
- lineNumber?: number;
60
- getLineNumber(): number;
61
- setLineNumber(): void;
62
-
63
- fileName?: string;
64
- getFileName(): string;
65
- setFileName(): void;
66
-
67
- functionName?: string;
68
- getFunctionName(): string;
69
- setFunctionName(): void;
70
-
71
- source?: string;
72
- getSource(): string;
73
- setSource(): void;
74
-
75
- args?: any[];
76
- getArgs(): any[];
77
- setArgs(): void;
78
-
79
- evalOrigin?: StackFrame;
80
- getEvalOrigin(): StackFrame;
81
- setEvalOrigin(): void;
82
-
83
- toString(): string;
84
- }
85
-
86
- declare class ErrorStackParser {
87
- parse(error: Error): Array<StackFrame>;
88
- }
89
-
90
- declare module.exports: ErrorStackParser;
91
-}
92
-
26
declare interface ConsoleTask {
27
run<T>(f: () => T): T;
28
}
29
30
+// $FlowFixMe[libdef-override]
31
declare var console: {
32
assert(condition: mixed, ...data: Array<any>): void,
33
clear(): void,
@@ -148,7 +82,7 @@ declare class ScrollTimeline extends AnimationTimeline {
82
83
// Flow hides the props of React$Element, this overrides it to unhide
84
// them for React internals.
151
-// prettier-ignore
85
+// $FlowFixMe[libdef-override]
86
declare opaque type React$Element<
87
+ElementType: React$ElementType,
88
+P = React$ElementProps<ElementType>,
@@ -227,100 +161,12 @@ declare var parcelRequire: {
161
},
162
};
163
230
-declare module 'fs/promises' {
231
- declare const access: (path: string, mode?: number) => Promise<void>;
232
- declare const lstat: (
233
- path: string,
234
- options?: ?{bigint?: boolean},
235
- ) => Promise<mixed>;
236
- declare const readdir: (
237
- path: string,
238
- options?:
239
- | ?string
240
- | {
241
- encoding?: ?string,
242
- withFileTypes?: ?boolean,
243
- },
244
- ) => Promise<Buffer>;
245
- declare const readFile: (
246
- path: string,
247
- options?:
248
- | ?string
249
- | {
250
- encoding?: ?string,
251
- },
252
- ) => Promise<Buffer>;
253
- declare const readlink: (
254
- path: string,
255
- options?:
256
- | ?string
257
- | {
258
- encoding?: ?string,
259
- },
260
- ) => Promise<mixed>;
261
- declare const realpath: (
262
- path: string,
263
- options?:
264
- | ?string
265
- | {
266
- encoding?: ?string,
267
- },
268
- ) => Promise<mixed>;
269
- declare const stat: (
270
- path: string,
271
- options?: ?{bigint?: boolean},
272
- ) => Promise<mixed>;
273
-}
164
declare module 'pg' {
165
declare const Pool: (options: mixed) => {
166
query: (query: string, values?: Array<mixed>) => void,
167
};
168
}
169
280
-declare module 'util' {
281
- declare function debuglog(section: string): (data: any, ...args: any) => void;
282
- declare function format(format: string, ...placeholders: any): string;
283
- declare function log(string: string): void;
284
- declare function inspect(object: any, options?: util$InspectOptions): string;
285
- declare function isArray(object: any): boolean;
286
- declare function isRegExp(object: any): boolean;
287
- declare function isDate(object: any): boolean;
288
- declare function isError(object: any): boolean;
289
- declare function inherits(
290
- constructor: Function,
291
- superConstructor: Function,
292
- ): void;
293
- declare function deprecate(f: Function, string: string): Function;
294
- declare function promisify(f: Function): Function;
295
- declare function callbackify(f: Function): Function;
296
- declare class TextDecoder {
297
- constructor(
298
- encoding?: string,
299
- options?: {
300
- fatal?: boolean,
301
- ignoreBOM?: boolean,
302
- ...
303
- },
304
- ): void;
305
- decode(
306
- input?: ArrayBuffer | DataView | $TypedArray,
307
- options?: {stream?: boolean, ...},
308
- ): string;
309
- encoding: string;
310
- fatal: boolean;
311
- ignoreBOM: boolean;
312
- }
313
- declare class TextEncoder {
314
- constructor(encoding?: string): TextEncoder;
315
- encode(buffer: string): Uint8Array;
316
- encodeInto(
317
- buffer: string,
318
- dest: Uint8Array,
319
- ): {read: number, written: number};
320
- encoding: string;
321
- }
322
-}
323
-
170
declare module 'busboy' {
171
import type {Writable, Readable} from 'stream';
172
@@ -456,13 +302,6 @@ declare const async_hooks: {
302
executionAsyncId(): number,
303
};
304
459
-declare module 'node:worker_threads' {
460
- declare class MessageChannel {
461
- port1: MessagePort;
462
- port2: MessagePort;
463
- }
464
-}
465
-
305
declare module 'jest-diff' {
306
declare type CompareKeys = ((a: string, b: string) => number) | void;
307
declare type DiffOptions = {
yarn.lock
+5
-5
@@ -9298,12 +9298,12 @@ flatted@^3.2.9:
9298
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a"
9299
integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==
9300
9301
-flow-bin@^0.263:
9302
- version "0.263.0"
9303
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.263.0.tgz#0a836bdf82855d5df9858c781818ce51612be064"
9304
- integrity sha512-FkQywD+7wXru/7/SWJPVnZXUp6CW3XtrVZ26vhAdVfMx9xlwq/Zk/tXcn3OQuiHUA4kQvZNyfgRztp6oXgjsog==
9301
+flow-bin@^0.265:
9302
+ version "0.265.3"
9303
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.265.3.tgz#cbaad2115f4622e34920981dc79949824c27f421"
9304
+ integrity sha512-08PjO2kjuQxy8MxYJNCzmgRpAe1uqTf7kQ+U32QTavRzTD/7IJASYKFEEvCkVNHlhSy8CTJsN+AQdHsXVqChIw==
9305
9306
-flow-remove-types@^2.263:
9306
+flow-remove-types@^2.265:
9307
version "2.279.0"
9308
resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5"
9309
integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA==