diff --git a/flow-typed/environments/node.js b/flow-typed/environments/node.js index 66d20232a3..a3edff20f8 100644 --- a/flow-typed/environments/node.js +++ b/flow-typed/environments/node.js @@ -3236,7 +3236,7 @@ declare module 'util' { declare class TextDecoder { constructor( encoding?: string, - options: { + options?: { fatal?: boolean, ignoreBOM?: boolean, ... @@ -3253,8 +3253,12 @@ declare module 'util' { declare class TextEncoder { constructor(): void; - encode(input?: string): Uint8Array; - encoding: string; + encode(input: string): Uint8Array; + encodeInto( + input: string, + buffer: Uint8Array + ): {written: number, read: number}; + encoding: 'utf-8'; } declare var types: { diff --git a/package.json b/package.json index 2a83ef95f2..20c893e5fb 100644 --- a/package.json +++ b/package.json @@ -74,8 +74,8 @@ "eslint-plugin-react-internal": "link:./scripts/eslint-rules", "fbjs-scripts": "^3.0.1", "filesize": "^6.0.1", - "flow-bin": "^0.263", - "flow-remove-types": "^2.263", + "flow-bin": "^0.265", + "flow-remove-types": "^2.265", "flow-typed": "^4.1.1", "glob": "^7.1.6", "glob-stream": "^6.1.0", diff --git a/packages/internal-test-utils/enqueueTask.js b/packages/internal-test-utils/enqueueTask.js index 9ddcf1d5ca..1edb75a7b1 100644 --- a/packages/internal-test-utils/enqueueTask.js +++ b/packages/internal-test-utils/enqueueTask.js @@ -11,6 +11,7 @@ const {MessageChannel} = require('node:worker_threads'); export default function enqueueTask(task: () => void): void { const channel = new MessageChannel(); + // $FlowFixMe[prop-missing] channel.port1.onmessage = () => { channel.port1.close(); task(); diff --git a/packages/react-devtools-shared/src/backend/profilingHooks.js b/packages/react-devtools-shared/src/backend/profilingHooks.js index ca58cf655c..a3feb17488 100644 --- a/packages/react-devtools-shared/src/backend/profilingHooks.js +++ b/packages/react-devtools-shared/src/backend/profilingHooks.js @@ -278,6 +278,7 @@ export function createProfilingHooks({ const top = currentReactMeasuresStack.pop(); // $FlowFixMe[incompatible-type] + // $FlowFixMe[incompatible-use] if (top.type !== type) { console.error( 'Unexpected type "%s" completed at %sms before "%s" completed.', diff --git a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js index f7415dbf46..57f121f6ec 100644 --- a/packages/react-reconciler/src/ReactFiberPerformanceTrack.js +++ b/packages/react-reconciler/src/ReactFiberPerformanceTrack.js @@ -712,7 +712,6 @@ export function logTransitionStart( const color = eventIsRepeat ? 'secondary-light' : 'warning'; if (__DEV__ && debugTask) { debugTask.run( - // $FlowFixMe[method-unbinding] console.timeStamp.bind( console, eventIsRepeat ? '' : 'Event: ' + eventType, diff --git a/packages/react-refresh/src/ReactFreshRuntime.js b/packages/react-refresh/src/ReactFreshRuntime.js index 43e8148d3d..079db6594a 100644 --- a/packages/react-refresh/src/ReactFreshRuntime.js +++ b/packages/react-refresh/src/ReactFreshRuntime.js @@ -671,8 +671,10 @@ export function isLikelyComponentType(type: any): boolean { // This looks like a class. return false; } - // eslint-disable-next-line no-proto - if (type.prototype.__proto__ !== Object.prototype) { + if ( + // $FlowFixMe[prop-missing] + type.prototype.__proto__ !== Object.prototype // eslint-disable-line no-proto + ) { // It has a superclass. return false; } diff --git a/scripts/flow/environment.js b/scripts/flow/environment.js index d8b2ac28f0..5556fad1a0 100644 --- a/scripts/flow/environment.js +++ b/scripts/flow/environment.js @@ -17,83 +17,17 @@ declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{ inject: ?((stuff: Object) => void) };*/ -declare const globalThis: Object; - -declare const queueMicrotask: (fn: Function) => void; declare const reportError: (error: mixed) => void; -declare const AggregateError: Class; - -declare const FinalizationRegistry: any; declare module 'create-react-class' { declare const exports: $FlowFixMe; } -declare module 'error-stack-parser' { - // flow-typed signature: 132e48034ef4756600e1d98681a166b5 - // flow-typed version: c6154227d1/error-stack-parser_v2.x.x/flow_>=v0.104.x - - declare interface StackFrame { - constructor(object: StackFrame): StackFrame; - - isConstructor?: boolean; - getIsConstructor(): boolean; - setIsConstructor(): void; - - isEval?: boolean; - getIsEval(): boolean; - setIsEval(): void; - - isNative?: boolean; - getIsNative(): boolean; - setIsNative(): void; - - isTopLevel?: boolean; - getIsTopLevel(): boolean; - setIsTopLevel(): void; - - columnNumber?: number; - getColumnNumber(): number; - setColumnNumber(): void; - - lineNumber?: number; - getLineNumber(): number; - setLineNumber(): void; - - fileName?: string; - getFileName(): string; - setFileName(): void; - - functionName?: string; - getFunctionName(): string; - setFunctionName(): void; - - source?: string; - getSource(): string; - setSource(): void; - - args?: any[]; - getArgs(): any[]; - setArgs(): void; - - evalOrigin?: StackFrame; - getEvalOrigin(): StackFrame; - setEvalOrigin(): void; - - toString(): string; - } - - declare class ErrorStackParser { - parse(error: Error): Array; - } - - declare module.exports: ErrorStackParser; -} - declare interface ConsoleTask { run(f: () => T): T; } +// $FlowFixMe[libdef-override] declare var console: { assert(condition: mixed, ...data: Array): void, clear(): void, @@ -148,7 +82,7 @@ declare class ScrollTimeline extends AnimationTimeline { // Flow hides the props of React$Element, this overrides it to unhide // them for React internals. -// prettier-ignore +// $FlowFixMe[libdef-override] declare opaque type React$Element< +ElementType: React$ElementType, +P = React$ElementProps, @@ -227,100 +161,12 @@ declare var parcelRequire: { }, }; -declare module 'fs/promises' { - declare const access: (path: string, mode?: number) => Promise; - declare const lstat: ( - path: string, - options?: ?{bigint?: boolean}, - ) => Promise; - declare const readdir: ( - path: string, - options?: - | ?string - | { - encoding?: ?string, - withFileTypes?: ?boolean, - }, - ) => Promise; - declare const readFile: ( - path: string, - options?: - | ?string - | { - encoding?: ?string, - }, - ) => Promise; - declare const readlink: ( - path: string, - options?: - | ?string - | { - encoding?: ?string, - }, - ) => Promise; - declare const realpath: ( - path: string, - options?: - | ?string - | { - encoding?: ?string, - }, - ) => Promise; - declare const stat: ( - path: string, - options?: ?{bigint?: boolean}, - ) => Promise; -} declare module 'pg' { declare const Pool: (options: mixed) => { query: (query: string, values?: Array) => void, }; } -declare module 'util' { - declare function debuglog(section: string): (data: any, ...args: any) => void; - declare function format(format: string, ...placeholders: any): string; - declare function log(string: string): void; - declare function inspect(object: any, options?: util$InspectOptions): string; - declare function isArray(object: any): boolean; - declare function isRegExp(object: any): boolean; - declare function isDate(object: any): boolean; - declare function isError(object: any): boolean; - declare function inherits( - constructor: Function, - superConstructor: Function, - ): void; - declare function deprecate(f: Function, string: string): Function; - declare function promisify(f: Function): Function; - declare function callbackify(f: Function): Function; - declare class TextDecoder { - constructor( - encoding?: string, - options?: { - fatal?: boolean, - ignoreBOM?: boolean, - ... - }, - ): void; - decode( - input?: ArrayBuffer | DataView | $TypedArray, - options?: {stream?: boolean, ...}, - ): string; - encoding: string; - fatal: boolean; - ignoreBOM: boolean; - } - declare class TextEncoder { - constructor(encoding?: string): TextEncoder; - encode(buffer: string): Uint8Array; - encodeInto( - buffer: string, - dest: Uint8Array, - ): {read: number, written: number}; - encoding: string; - } -} - declare module 'busboy' { import type {Writable, Readable} from 'stream'; @@ -456,13 +302,6 @@ declare const async_hooks: { executionAsyncId(): number, }; -declare module 'node:worker_threads' { - declare class MessageChannel { - port1: MessagePort; - port2: MessagePort; - } -} - declare module 'jest-diff' { declare type CompareKeys = ((a: string, b: string) => number) | void; declare type DiffOptions = { diff --git a/yarn.lock b/yarn.lock index 0acce52fd4..a4ba51b2c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9298,12 +9298,12 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -flow-bin@^0.263: - version "0.263.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.263.0.tgz#0a836bdf82855d5df9858c781818ce51612be064" - integrity sha512-FkQywD+7wXru/7/SWJPVnZXUp6CW3XtrVZ26vhAdVfMx9xlwq/Zk/tXcn3OQuiHUA4kQvZNyfgRztp6oXgjsog== +flow-bin@^0.265: + version "0.265.3" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.265.3.tgz#cbaad2115f4622e34920981dc79949824c27f421" + integrity sha512-08PjO2kjuQxy8MxYJNCzmgRpAe1uqTf7kQ+U32QTavRzTD/7IJASYKFEEvCkVNHlhSy8CTJsN+AQdHsXVqChIw== -flow-remove-types@^2.263: +flow-remove-types@^2.265: version "2.279.0" resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-2.279.0.tgz#3a3388d9158eba0f82c40d80d31d9640b883a3f5" integrity sha512-bPFloMR/A2b/r/sIsf7Ix0LaMicCJNjwhXc4xEEQVzJCIz5u7C7XDaEOXOiqveKlCYK7DcBNn6R01Cbbc9gsYA==