Upgrade Flow in fbsource

Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D129627765

Pull Request resolved: https://github.com/react/react-native/pull/59803
This commit is contained in:
Sam Zhou authored and GitHub committed 2026-11-04 23:34:52 +00:00
1 parent 38f6e192c8
commit ca4afe5d30
5 files changed
+8 -1

No files matched your search

@@ -19,7 +19,8 @@ export class CLIError extends Error {
this.stack =
typeof originalError === 'string'
? originalError
: originalError.stack || ''.split('\n').slice(0, 2).join('\n');
: // $FlowFixMe[sketchy-null-string]
originalError.stack || ''.split('\n').slice(0, 2).join('\n');
} else {
// When the "originalError" is not passed, it means that we know exactly
// what went wrong and provide means to fix it. In such cases showing the
@@ -210,6 +210,7 @@ class DeviceEventReporter {
error: Error,
message: string,
): void {
// $FlowFixMe[incompatible-type]
this.#eventReporter.logEvent({
type: 'proxy_error',
status: 'error',
@@ -163,6 +163,7 @@ function handleException(e: unknown, isFatal: boolean) {
// Unfortunately there is no way to figure out the stacktrace in this
// case, so if you ended up here trying to trace an error, look for
// `throw '<error message>'` somewhere in your codebase.
// $FlowFixMe[incompatible-type]
error = new SyntheticError(e);
}
try {
+1
View File
@@ -18,6 +18,7 @@
const logError = function (...args: ReadonlyArray<unknown>) {
if (args.length === 1 && args[0] instanceof Error) {
const err = args[0];
// $FlowFixMe[unsafe-addition]
console.error('Error: "' + err.message + '". Stack:\n' + err.stack);
} else {
console.error.apply(console, args);
+3
View File
@@ -17,6 +17,7 @@ import {format, plugins} from 'pretty-format';
const stringify = (data: unknown): string =>
format(data, {min: true, plugins: [plugins.ReactElement]});
// $FlowFixMe[incompatible-type]
class ErrorWithCustomBlame extends Error {
// Initially 5 to ignore all the frames from Babel helpers to instantiate this
// custom error class.
@@ -48,6 +49,7 @@ class ErrorWithCustomBlame extends Error {
// $FlowExpectedError[incompatible-type]
delete this.stack;
// $FlowFixMe[incompatible-use]
const lines = originalStack.split('\n');
const index = lines.findIndex(line =>
/at (.*) \((.*):(\d+):(\d+)\)/.test(line),
@@ -70,6 +72,7 @@ class ErrorWithCustomBlame extends Error {
// In this case we're inheriting the error and we don't know if the stack
// contains helpers that we need to ignore.
errorWithCustomBlame.#ignoredFrameCount = 0;
// $FlowFixMe[incompatible-type]
errorWithCustomBlame.stack = error.stack;
return errorWithCustomBlame;
}