mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[react] ReactType -> ElementType
This commit is contained in:
10
types/react/index.d.ts
vendored
10
types/react/index.d.ts
vendored
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user