diff --git a/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/IntegrationTests/GlobalEvalWithSourceUrlTest.js index fca7bfbc217..a69ee3728c4 100644 --- a/IntegrationTests/GlobalEvalWithSourceUrlTest.js +++ b/IntegrationTests/GlobalEvalWithSourceUrlTest.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ExtendedError} from 'react-native/Libraries/Core/Devtools/parseErrorStack'; +import type {ExtendedError} from 'react-native/Libraries/Core/ExtendedError'; const React = require('react'); const ReactNative = require('react-native'); diff --git a/Libraries/BatchedBridge/NativeModules.js b/Libraries/BatchedBridge/NativeModules.js index 4f764463738..a9b7619944e 100644 --- a/Libraries/BatchedBridge/NativeModules.js +++ b/Libraries/BatchedBridge/NativeModules.js @@ -14,7 +14,7 @@ const BatchedBridge = require('./BatchedBridge'); const invariant = require('invariant'); -import type {ExtendedError} from '../Core/Devtools/parseErrorStack'; +import type {ExtendedError} from '../Core/ExtendedError'; export type ModuleConfig = [ string /* name */, diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index 1c4e1f67535..185ddcb7e75 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -15,16 +15,6 @@ import type {HermesParsedStack} from './parseHermesStack'; const parseHermesStack = require('./parseHermesStack'); -// $FlowFixMe[incompatible-exact] -export type ExtendedError = Error & - interface { - jsEngine?: string, - preventSymbolication?: boolean, - componentStack?: string, - forceRedbox?: boolean, - isComponentError?: boolean, - }; - function convertHermesStack(stack: HermesParsedStack): Array { const frames = []; for (const entry of stack.entries) { diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index fd1afec1cea..9f0d2a3c6d6 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ExtendedError} from './Devtools/parseErrorStack'; +import type {ExtendedError} from './ExtendedError'; import type {ExceptionData} from './NativeExceptionsManager'; class SyntheticError extends Error { diff --git a/Libraries/Core/ExtendedError.js b/Libraries/Core/ExtendedError.js new file mode 100644 index 00000000000..6acd8abca0d --- /dev/null +++ b/Libraries/Core/ExtendedError.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +export type ExtendedError = Error & { + jsEngine?: string, + preventSymbolication?: boolean, + componentStack?: string, + forceRedbox?: boolean, + isComponentError?: boolean, + ... +}; diff --git a/Libraries/Core/ReactFiberErrorDialog.js b/Libraries/Core/ReactFiberErrorDialog.js index 974bb9d4c90..759c30b94a5 100644 --- a/Libraries/Core/ReactFiberErrorDialog.js +++ b/Libraries/Core/ReactFiberErrorDialog.js @@ -10,7 +10,7 @@ import {handleException, SyntheticError} from './ExceptionsManager'; -import type {ExtendedError} from './Devtools/parseErrorStack'; +import type {ExtendedError} from './ExtendedError'; export type CapturedError = { +componentStack: string, diff --git a/Libraries/LogBox/Data/LogBoxData.js b/Libraries/LogBox/Data/LogBoxData.js index b9890449b4c..d247c8d8d99 100644 --- a/Libraries/LogBox/Data/LogBoxData.js +++ b/Libraries/LogBox/Data/LogBoxData.js @@ -21,7 +21,7 @@ import type { ExtendedExceptionData, } from './parseLogBoxLog'; import parseErrorStack from '../../Core/Devtools/parseErrorStack'; -import type {ExtendedError} from '../../Core/Devtools/parseErrorStack'; +import type {ExtendedError} from '../../Core/ExtendedError'; import NativeLogBox from '../../NativeModules/specs/NativeLogBox'; export type LogBoxLogs = Set; export type LogData = $ReadOnly<{| diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index 7d6915c3d21..e24c7642179 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -17,7 +17,7 @@ const prettyFormat = require('pretty-format'); import getDevServer from '../Core/Devtools/getDevServer'; import NativeRedBox from '../NativeModules/specs/NativeRedBox'; import LogBox from '../LogBox/LogBox'; -import type {ExtendedError} from '../Core/Devtools/parseErrorStack'; +import type {ExtendedError} from '../Core/ExtendedError'; const pendingEntryPoints = []; let hmrClient = null;