Skip to content

Commit

Permalink
Removed forked DevTools Flow types
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 27, 2019
1 parent 9a016c0 commit 8c684bf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 110 deletions.
3 changes: 2 additions & 1 deletion packages/react-devtools-shared/src/backend/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import {getInternalReactConstants} from './renderer';
import describeComponentFrame from './describeComponentFrame';

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

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

Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ import {
registerRenderer as registerRendererWithConsole,
} from './console';

import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {
ChangeDescription,
CommitDataBackend,
DevToolsHook,
Fiber,
InspectedElement,
InspectedElementPayload,
InstanceAndStyle,
Expand Down
106 changes: 3 additions & 103 deletions packages/react-devtools-shared/src/backend/types.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// @flow

import type {ReactContext} from 'shared/ReactTypes';
import type {Source} from 'shared/ReactElementType';
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {
ComponentFilter,
ElementType,
Expand All @@ -14,69 +17,6 @@ type BundleType =
export type WorkTag = number;
export type SideEffectTag = number;
export type ExpirationTime = number;
export type RefObject = {|
current: any,
|};
export type Source = {|
fileName: string,
lineNumber: number,
|};

export type HookType =
| 'useState'
| 'useReducer'
| 'useContext'
| 'useRef'
| 'useEffect'
| 'useLayoutEffect'
| 'useCallback'
| 'useMemo'
| 'useImperativeHandle'
| 'useDebugValue';

// The Fiber type is copied from React and should be kept in sync:
// https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactFiber.js
// The properties we don't use in DevTools are omitted.
export type Fiber = {|
tag: WorkTag,

key: null | string,

// Dependencies (contexts, events) for this fiber, if it has any
dependencies: mixed | null,

elementType: any,

type: any,

stateNode: any,

return: Fiber | null,

child: Fiber | null,
sibling: Fiber | null,
index: number,

ref: null | (((handle: mixed) => void) & {_stringRef: ?string}) | RefObject,

pendingProps: any, // This type will be more specific once we overload the tag.
memoizedProps: any, // The props used to create the output.

memoizedState: any,

effectTag: SideEffectTag,

alternate: Fiber | null,

actualDuration?: number,

actualStartTime?: number,

treeBaseDuration?: number,

_debugSource?: Source | null,
_debugOwner?: Fiber | null,
|};

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

export type ReactContext<T> = {
$$typeof: Symbol | number,
Consumer: ReactContext<T>,
Provider: ReactProviderType<T>,

_calculateChangedBits: ((a: T, b: T) => number) | null,

_currentValue: T,
_currentValue2: T,
_threadCount: number,

// DEV only
_currentRenderer?: Object | null,
_currentRenderer2?: Object | null,
};

export type ReactRenderer = {
findFiberByHostInstance: (hostInstance: NativeType) => ?Fiber,
version: string,
Expand Down Expand Up @@ -349,27 +273,3 @@ export type DevToolsHook = {
commitPriority?: number,
) => void,
};

export type ReactEventResponder<E, C> = {
$$typeof: Symbol | number,
displayName: string,
targetEventTypes: null | Array<string>,
rootEventTypes: null | Array<string>,
getInitialState: null | ((props: Object) => Object),
onEvent:
| null
| ((event: E, context: C, props: Object, state: Object) => void),
onRootEvent:
| null
| ((event: E, context: C, props: Object, state: Object) => void),
onMount: null | ((context: C, props: Object, state: Object) => void),
onUnmount: null | ((context: C, props: Object, state: Object) => void),
onOwnershipChange:
| null
| ((context: C, props: Object, state: Object) => void),
};

export type ReactEventResponderListener<E, C> = {|
props: Object,
responder: ReactEventResponder<E, C>,
|};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow

import type {Source} from 'shared/ReactElementType';
import type {
Dehydrated,
Unserializable,
Expand Down Expand Up @@ -48,11 +49,6 @@ export type OwnersList = {|
owners: Array<Owner> | null,
|};

export type Source = {|
fileName: string,
lineNumber: number,
|};

export type InspectedElement = {|
id: number,

Expand Down

0 comments on commit 8c684bf

Please sign in to comment.