Skip to content

Commit

Permalink
fix: flow types
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Feb 13, 2020
1 parent 21a87a4 commit ea82cd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type ReactContext<T> = {
$$typeof: Symbol | number,
Consumer: ReactContext<T>,
Provider: ReactProviderType<T>,
displayName?: string;
_calculateChangedBits: ((a: T, b: T) => number) | null,
_currentValue: T,
_currentValue2: T,
Expand Down
8 changes: 5 additions & 3 deletions packages/shared/getComponentName.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
REACT_CHUNK_TYPE,
} from 'shared/ReactSymbols';
import {refineResolvedLazyComponent} from 'shared/ReactLazyComponent';
import type {ReactContext} from 'shared/ReactTypes';
import type {ReactContext,ReactProviderType} from 'shared/ReactTypes';

function getWrappedName(
outerType: mixed,
Expand Down Expand Up @@ -78,9 +78,11 @@ function getComponentName(type: mixed): string | null {
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
return getContextName(type) + '.Consumer';
const context: ReactContext<any> = (type: any);
return getContextName(context) + '.Consumer';
case REACT_PROVIDER_TYPE:
return getContextName(type._context) + '.Provider';
const provider: ReactProviderType<any> = (type: any);
return getContextName(provider._context) + '.Provider';
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, 'ForwardRef');
case REACT_MEMO_TYPE:
Expand Down

0 comments on commit ea82cd5

Please sign in to comment.