Polymorphism and refs types #665
-
I'm having trouble correctly typing something. Here's an ultra-minimal repro: https://codesandbox.io/s/mystifying-jennings-glrz5?file=/src/App.tsx Basically, I want to dynamically set the element ( Findings:
What am I doing wrong here? I've tried many things, but none have worked so far. Thanks in advance for any help! 😄 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This looks like it could be a bug as I would have expected you would be able to do the following which also doesn't work: const ref = React.useRef<HTMLButtonElement | HTMLDivElement>(null); It appears this should be possible so I'll raise an issue from this discussion for us to look into further. EDIT: I've raised the issue here if you'd like to follow progress. |
Beta Was this translation helpful? Give feedback.
This looks like it could be a bug as I would have expected you would be able to do the following which also doesn't work:
It appears this should be possible so I'll raise an issue from this discussion for us to look into further.
EDIT: I've raised the issue here if you'd like to follow progress.