Merge pull request #33263 from eps1lon/feat/react/elementType

[react] ReactType -> ElementType
This commit is contained in:
Jesse Trinity
2019-02-28 10:29:15 -08:00
committed by GitHub
+7 -3
View File
@@ -51,11 +51,15 @@ declare namespace React {
// React Elements
// ----------------------------------------------------------------------
type ReactType<P = any> =
type ElementType<P = any> =
{
[K in keyof JSX.IntrinsicElements]: P extends JSX.IntrinsicElements[K] ? K : never
}[keyof JSX.IntrinsicElements] |
ComponentType<P>;
/**
* @deprecated Please use `ElementType`
*/
type ReactType<P = any> = ElementType<P>;
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
type JSXElementConstructor<P> =
@@ -734,11 +738,11 @@ declare namespace React {
: T extends keyof JSX.IntrinsicElements
? JSX.IntrinsicElements[T]
: {};
type ComponentPropsWithRef<T extends ReactType> =
type ComponentPropsWithRef<T extends ElementType> =
T extends ComponentClass<infer P>
? PropsWithoutRef<P> & RefAttributes<InstanceType<T>>
: PropsWithRef<ComponentProps<T>>;
type ComponentPropsWithoutRef<T extends ReactType> =
type ComponentPropsWithoutRef<T extends ElementType> =
PropsWithoutRef<ComponentProps<T>>;
// will show `Memo(${Component.displayName || Component.name})` in devtools by default,