-
-
Notifications
You must be signed in to change notification settings - Fork 311
Closed as not planned
Labels
Description
Hello together,
with the following usage of forwardRef union types get lost:
interface Props {
/** The name to greet */
name: "world" | "hello";
title: string;
}
/**
* Hello world component
*/
const MyComponent = forwardRef<ElementRef<"div">, Props>(
({name = 'world'}, ref) => {
return <div />;
}
);A workaround is to add the type "Props to the spread as well:
interface Props {
/** The name to greet */
name: "world" | "hello";
title: string;
}
/**
* Hello world component
*/
const MyComponent = forwardRef<ElementRef<"div">, Props>(
({name = 'world'}: Props, ref) => {
return <div />;
}
);But this is redundant because the type is already defined as a generic at the forwardRef function.
Would it be possible to support the generics of forwardRef?
Thanks in regards