You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Headingas="h1"color="green"// error: Parameter 'element' implicitly has an 'any' type.ref={(element)=>{}}>Ash1</Heading>
Note that when creating a props object to pass to Heading the ref element type is inferred correctly:
constpropsForHeading: HeadingProps<"h1">={// element type is inferred correctlyref: (element)=>{},children: "Heading using propsForHeading"};
...
<Heading{...propsForHeading}/>
Thank you again for reporting with a clear reproduction for your case.
Unfortunately, this seems to be a limitation of TypeScript rather than an issue with this library. Please follow along the following issue for further details: kripod/react-polymorphic-box#13
Please provide the element type explicitly until a fix is available:
<Headingas="h1"color="green"ref={(element: HTMLHeadingElement|null)=>{}}>
As h1
</Heading>
@kripod I think it's fair to assume that the previously mentioned PR has been released by now. Unfortunately this issue has not been fixed by that change. Perhaps you could re-open this issue?
Activity
kripod commentedon Apr 2, 2021
Hello,
Thank you again for reporting with a clear reproduction for your case.
Unfortunately, this seems to be a limitation of TypeScript rather than an issue with this library. Please follow along the following issue for further details: kripod/react-polymorphic-box#13
Please provide the element type explicitly until a fix is available:
rafgraph commentedon Apr 2, 2021
Thanks for the info. It looks like microsoft/TypeScript#31023 was merged in December, but not sure if it's been released yet.
Mesoptier commentedon Apr 29, 2021
@kripod I think it's fair to assume that the previously mentioned PR has been released by now. Unfortunately this issue has not been fixed by that change. Perhaps you could re-open this issue?
Mesoptier commentedon Jul 12, 2022
This comment is relevant for this issue as well: