Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions flow-typed/environments/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3236,7 +3236,7 @@ declare module 'util' {
declare class TextDecoder {
constructor(
encoding?: string,
options: {
options?: {
fatal?: boolean,
ignoreBOM?: boolean,
...
Expand All @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/internal-test-utils/enqueueTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions packages/react-refresh/src/ReactFreshRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
165 changes: 2 additions & 163 deletions scripts/flow/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Error>;

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<StackFrame>;
}

declare module.exports: ErrorStackParser;
}

declare interface ConsoleTask {
run<T>(f: () => T): T;
}

// $FlowFixMe[libdef-override]
declare var console: {
assert(condition: mixed, ...data: Array<any>): void,
clear(): void,
Expand Down Expand Up @@ -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<ElementType>,
Expand Down Expand Up @@ -227,100 +161,12 @@ declare var parcelRequire: {
},
};

declare module 'fs/promises' {
declare const access: (path: string, mode?: number) => Promise<void>;
declare const lstat: (
path: string,
options?: ?{bigint?: boolean},
) => Promise<mixed>;
declare const readdir: (
path: string,
options?:
| ?string
| {
encoding?: ?string,
withFileTypes?: ?boolean,
},
) => Promise<Buffer>;
declare const readFile: (
path: string,
options?:
| ?string
| {
encoding?: ?string,
},
) => Promise<Buffer>;
declare const readlink: (
path: string,
options?:
| ?string
| {
encoding?: ?string,
},
) => Promise<mixed>;
declare const realpath: (
path: string,
options?:
| ?string
| {
encoding?: ?string,
},
) => Promise<mixed>;
declare const stat: (
path: string,
options?: ?{bigint?: boolean},
) => Promise<mixed>;
}
declare module 'pg' {
declare const Pool: (options: mixed) => {
query: (query: string, values?: Array<mixed>) => 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';

Expand Down Expand Up @@ -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 = {
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down