@samitouri / QOS-React-2 / commits / 8c684bf7e1

Removed forked DevTools Flow types

Brian Vaughn committed Aug 27, 2019 at 10:42 UTC 8c684bf7e19d6942eb9adb9d16aefe5dc8491bfa
4 files changed +7 -110
packages/react-devtools-shared/src/backend/console.js
+2 -1
@@ -3,7 +3,8 @@
3 import {getInternalReactConstants} from './renderer';
4 import describeComponentFrame from './describeComponentFrame';
5
6 -import type {Fiber, ReactRenderer} from './types';
6 +import type {Fiber} from 'react-reconciler/src/ReactFiber';
7 +import type {ReactRenderer} from './types';
8
9 const APPEND_STACK_TO_METHODS = ['error', 'trace', 'warn'];
10
packages/react-devtools-shared/src/backend/renderer.js
+1 -1
@@ -42,11 +42,11 @@ import {
42 registerRenderer as registerRendererWithConsole,
43 } from './console';
44
45 +import type {Fiber} from 'react-reconciler/src/ReactFiber';
46 import type {
47 ChangeDescription,
48 CommitDataBackend,
49 DevToolsHook,
49 - Fiber,
50 InspectedElement,
51 InspectedElementPayload,
52 InstanceAndStyle,
packages/react-devtools-shared/src/backend/types.js
+3 -103
@@ -1,5 +1,8 @@
1 // @flow
2
3 +import type {ReactContext} from 'shared/ReactTypes';
4 +import type {Source} from 'shared/ReactElementType';
5 +import type {Fiber} from 'react-reconciler/src/ReactFiber';
6 import type {
7 ComponentFilter,
8 ElementType,
@@ -14,69 +17,6 @@ type BundleType =
17 export type WorkTag = number;
18 export type SideEffectTag = number;
19 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 -|};
20
21 // TODO: If it's useful for the frontend to know which types of data an Element has
22 // (e.g. props, state, context, hooks) then we could add a bitmask field for this
@@ -103,22 +43,6 @@ export type ReactProviderType<T> = {
43 _context: ReactContext<T>,
44 };
45
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 -
46 export type ReactRenderer = {
47 findFiberByHostInstance: (hostInstance: NativeType) => ?Fiber,
48 version: string,
@@ -349,27 +273,3 @@ export type DevToolsHook = {
273 commitPriority?: number,
274 ) => void,
275 };
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
+1 -5
@@ -1,5 +1,6 @@
1 // @flow
2
3 +import type {Source} from 'shared/ReactElementType';
4 import type {
5 Dehydrated,
6 Unserializable,
@@ -48,11 +49,6 @@ export type OwnersList = {|
49 owners: Array<Owner> | null,
50 |};
51
51 -export type Source = {|
52 - fileName: string,
53 - lineNumber: number,
54 -|};
55 -
52 export type InspectedElement = {|
53 id: number,
54