Typescript: What is the type of React Router Link

Viewed 39

I'm passing Link from react-router-dom as props, And need to define it in the interface. When hovering over the Link element, I see that it's of type:

React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>

But I don't understand what that LinkProps is, I tried to define the type as:

React.ForwardRefExoticComponent<HTMLElement>;

And a few other options, but I always get the error that the type of

React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>

Is not assignable to the type I'm trying to use. It only works with:

React.ForwardRefExoticComponent<any>;

How can I find out the correct type?

1 Answers

try this

React.forwardRef<HTMLAnchorElement, LinkProps>
Related