From 3cf39b0d19e75015c39cf496460d4141f59611f0 Mon Sep 17 00:00:00 2001 From: Hamza Benkhaldoun Date: Sat, 6 Jul 2024 05:07:12 +0100 Subject: [PATCH 1/2] Add missing types ElementType and ComponentPropsWithoutRef --- compat/src/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compat/src/index.d.ts b/compat/src/index.d.ts index d9656f95a6..e16a76bfe9 100644 --- a/compat/src/index.d.ts +++ b/compat/src/index.d.ts @@ -725,6 +725,13 @@ declare namespace React { | MutableRefObject | null; + export type ElementType

= + | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] + | ComponentType

; + + export type ComponentPropsWithoutRef = PropsWithoutRef>; + + export type ComponentPropsWithRef< C extends ComponentType | keyof JSXInternal.IntrinsicElements > = C extends new ( From 212b17af406e4834c91613bd4f836a826ed52136 Mon Sep 17 00:00:00 2001 From: Ryan Christian <33403762+rschristian@users.noreply.github.com> Date: Sat, 6 Jul 2024 00:30:16 -0500 Subject: [PATCH 2/2] chore: Fix formatting --- compat/src/index.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compat/src/index.d.ts b/compat/src/index.d.ts index e16a76bfe9..ee7725228c 100644 --- a/compat/src/index.d.ts +++ b/compat/src/index.d.ts @@ -726,11 +726,10 @@ declare namespace React { | null; export type ElementType

= - | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] - | ComponentType

; - - export type ComponentPropsWithoutRef = PropsWithoutRef>; + | { [K in Tag]: P extends JSX.IntrinsicElements[K] ? K : never }[Tag] + | ComponentType

; + export type ComponentPropsWithoutRef = PropsWithoutRef>; export type ComponentPropsWithRef< C extends ComponentType | keyof JSXInternal.IntrinsicElements