Skip to content

Commit 8c684bf

Browse files
author
Brian Vaughn
committed
Removed forked DevTools Flow types
1 parent 9a016c0 commit 8c684bf

File tree

4 files changed

+7
-110
lines changed

4 files changed

+7
-110
lines changed

packages/react-devtools-shared/src/backend/console.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import {getInternalReactConstants} from './renderer';
44
import describeComponentFrame from './describeComponentFrame';
55

6-
import type {Fiber, ReactRenderer} from './types';
6+
import type {Fiber} from 'react-reconciler/src/ReactFiber';
7+
import type {ReactRenderer} from './types';
78

89
const APPEND_STACK_TO_METHODS = ['error', 'trace', 'warn'];
910

packages/react-devtools-shared/src/backend/renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ import {
4242
registerRenderer as registerRendererWithConsole,
4343
} from './console';
4444

45+
import type {Fiber} from 'react-reconciler/src/ReactFiber';
4546
import type {
4647
ChangeDescription,
4748
CommitDataBackend,
4849
DevToolsHook,
49-
Fiber,
5050
InspectedElement,
5151
InspectedElementPayload,
5252
InstanceAndStyle,

packages/react-devtools-shared/src/backend/types.js

Lines changed: 3 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// @flow
22

3+
import type {ReactContext} from 'shared/ReactTypes';
4+
import type {Source} from 'shared/ReactElementType';
5+
import type {Fiber} from 'react-reconciler/src/ReactFiber';
36
import type {
47
ComponentFilter,
58
ElementType,
@@ -14,69 +17,6 @@ type BundleType =
1417
export type WorkTag = number;
1518
export type SideEffectTag = number;
1619
export type ExpirationTime = number;
17-
export type RefObject = {|
18-
current: any,
19-
|};
20-
export type Source = {|
21-
fileName: string,
22-
lineNumber: number,
23-
|};
24-
25-
export type HookType =
26-
| 'useState'
27-
| 'useReducer'
28-
| 'useContext'
29-
| 'useRef'
30-
| 'useEffect'
31-
| 'useLayoutEffect'
32-
| 'useCallback'
33-
| 'useMemo'
34-
| 'useImperativeHandle'
35-
| 'useDebugValue';
36-
37-
// The Fiber type is copied from React and should be kept in sync:
38-
// https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactFiber.js
39-
// The properties we don't use in DevTools are omitted.
40-
export type Fiber = {|
41-
tag: WorkTag,
42-
43-
key: null | string,
44-
45-
// Dependencies (contexts, events) for this fiber, if it has any
46-
dependencies: mixed | null,
47-
48-
elementType: any,
49-
50-
type: any,
51-
52-
stateNode: any,
53-
54-
return: Fiber | null,
55-
56-
child: Fiber | null,
57-
sibling: Fiber | null,
58-
index: number,
59-
60-
ref: null | (((handle: mixed) => void) & {_stringRef: ?string}) | RefObject,
61-
62-
pendingProps: any, // This type will be more specific once we overload the tag.
63-
memoizedProps: any, // The props used to create the output.
64-
65-
memoizedState: any,
66-
67-
effectTag: SideEffectTag,
68-
69-
alternate: Fiber | null,
70-
71-
actualDuration?: number,
72-
73-
actualStartTime?: number,
74-
75-
treeBaseDuration?: number,
76-
77-
_debugSource?: Source | null,
78-
_debugOwner?: Fiber | null,
79-
|};
8020

8121
// TODO: If it's useful for the frontend to know which types of data an Element has
8222
// (e.g. props, state, context, hooks) then we could add a bitmask field for this
@@ -103,22 +43,6 @@ export type ReactProviderType<T> = {
10343
_context: ReactContext<T>,
10444
};
10545

106-
export type ReactContext<T> = {
107-
$$typeof: Symbol | number,
108-
Consumer: ReactContext<T>,
109-
Provider: ReactProviderType<T>,
110-
111-
_calculateChangedBits: ((a: T, b: T) => number) | null,
112-
113-
_currentValue: T,
114-
_currentValue2: T,
115-
_threadCount: number,
116-
117-
// DEV only
118-
_currentRenderer?: Object | null,
119-
_currentRenderer2?: Object | null,
120-
};
121-
12246
export type ReactRenderer = {
12347
findFiberByHostInstance: (hostInstance: NativeType) => ?Fiber,
12448
version: string,
@@ -349,27 +273,3 @@ export type DevToolsHook = {
349273
commitPriority?: number,
350274
) => void,
351275
};
352-
353-
export type ReactEventResponder<E, C> = {
354-
$$typeof: Symbol | number,
355-
displayName: string,
356-
targetEventTypes: null | Array<string>,
357-
rootEventTypes: null | Array<string>,
358-
getInitialState: null | ((props: Object) => Object),
359-
onEvent:
360-
| null
361-
| ((event: E, context: C, props: Object, state: Object) => void),
362-
onRootEvent:
363-
| null
364-
| ((event: E, context: C, props: Object, state: Object) => void),
365-
onMount: null | ((context: C, props: Object, state: Object) => void),
366-
onUnmount: null | ((context: C, props: Object, state: Object) => void),
367-
onOwnershipChange:
368-
| null
369-
| ((context: C, props: Object, state: Object) => void),
370-
};
371-
372-
export type ReactEventResponderListener<E, C> = {|
373-
props: Object,
374-
responder: ReactEventResponder<E, C>,
375-
|};

packages/react-devtools-shared/src/devtools/views/Components/types.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow
22

3+
import type {Source} from 'shared/ReactElementType';
34
import type {
45
Dehydrated,
56
Unserializable,
@@ -48,11 +49,6 @@ export type OwnersList = {|
4849
owners: Array<Owner> | null,
4950
|};
5051

51-
export type Source = {|
52-
fileName: string,
53-
lineNumber: number,
54-
|};
55-
5652
export type InspectedElement = {|
5753
id: number,
5854

0 commit comments

Comments
 (0)