Skip to content

Commit b55b26c

Browse files
rickhanloniimeta-codesync[bot]
authored andcommitted
Extract shared SymbolicationState type (#55227)
Summary: Pull Request resolved: #55227 The `symbolicated` and `symbolicatedComponentStack` fields had identical inline union types duplicated in their definitions. This extracts a shared `SymbolicationState` type to reduce duplication and improve maintainability. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D90896974 fbshipit-source-id: 198d0cd4b68e4e0cad2163192dce45ef44b12c51
1 parent 8af50b2 commit b55b26c

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

packages/react-native/Libraries/LogBox/Data/LogBoxLog.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import * as LogBoxSymbolication from './LogBoxSymbolication';
1515

1616
type SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';
1717

18+
type SymbolicationState =
19+
| Readonly<{error: null, stack: null, status: 'NONE'}>
20+
| Readonly<{error: null, stack: null, status: 'PENDING'}>
21+
| Readonly<{error: null, stack: Stack, status: 'COMPLETE'}>
22+
| Readonly<{error: Error, stack: null, status: 'FAILED'}>;
23+
1824
export type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax';
1925

2026
export type LogBoxLogData = Readonly<{
@@ -42,24 +48,12 @@ class LogBoxLog {
4248
componentCodeFrame: ?CodeFrame;
4349
isComponentError: boolean;
4450
extraData: unknown | void;
45-
symbolicated:
46-
| Readonly<{error: null, stack: null, status: 'NONE'}>
47-
| Readonly<{error: null, stack: null, status: 'PENDING'}>
48-
| Readonly<{error: null, stack: Stack, status: 'COMPLETE'}>
49-
| Readonly<{error: Error, stack: null, status: 'FAILED'}> = {
51+
symbolicated: SymbolicationState = {
5052
error: null,
5153
stack: null,
5254
status: 'NONE',
5355
};
54-
symbolicatedComponentStack:
55-
| Readonly<{error: null, stack: null, status: 'NONE'}>
56-
| Readonly<{error: null, stack: null, status: 'PENDING'}>
57-
| Readonly<{
58-
error: null,
59-
stack: Stack,
60-
status: 'COMPLETE',
61-
}>
62-
| Readonly<{error: Error, stack: null, status: 'FAILED'}> = {
56+
symbolicatedComponentStack: SymbolicationState = {
6357
error: null,
6458
stack: null,
6559
status: 'NONE',

0 commit comments

Comments
 (0)