I tried to update our typescript to 5.1 and now we are seeing errors on our usage of PolymorphicForwardRefExoticComponent. The same error also happens with PolymorphicMemoExoticComponent
Type 'ForwardRefExoticComponent<Omit<Omit<SVGProps<SVGSymbolElement>, "ref"> | Omit<DetailedHTMLProps<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>, "ref"> | ... 121 more ... | Omit<...>, "as" | "color"> & HeadingOwnProps & { ...; } & RefAttributes<...>>' is not assignable to type 'PolymorphicForwardRefExoticComponent<HeadingOwnProps, "h2">'.
Type 'ForwardRefExoticComponent<Omit<Omit<SVGProps<SVGSymbolElement>, "ref"> | Omit<DetailedHTMLProps<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>, "ref"> | ... 121 more ... | Omit<...>, "as" | "color"> & HeadingOwnProps & { ...; } & RefAttributes<...>>' is not assignable to type '<InstanceT extends ElementType<any> = "h2">(props: PolymorphicPropsWithRef<HeadingOwnProps, InstanceT>) => ReactElement<any, string | JSXElementConstructor<...>> | null'.
Type 'ReactNode' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>> | null'.
Type 'undefined' is not assignable to type 'ReactElement<any, string | JSXElementConstructor<any>> | null'.
my lib versions are:
Typescript: 5.1.3
@types/react: 18.2.14
@types/react-dom: 18.2.6
Hello!
I tried to update our typescript to 5.1 and now we are seeing errors on our usage of
PolymorphicForwardRefExoticComponent
. The same error also happens withPolymorphicMemoExoticComponent
It also errors on playground using the example from the package: TS Playground with Error
Full Error is:
my lib versions are: Typescript: 5.1.3 @types/react: 18.2.14 @types/react-dom: 18.2.6
Thank you