Closed Sliov closed 1 year ago
Still figuring out how to fix this, I did find out what the problem is however, something about how the comments are lost when using union types (playground here).
Now the problem here is that I use a janky trick for correctly inferring props which involves using unions to fix (#2 ). The good news is that that trick isn't needed anymore cause somehow miraculously typescript (i think ts-server) was now able to infer props correctly, the bad news is that in some cases where heavier computations on types are needed it incorrectly infers props again and the trick is again needed to correct it.
I'm unsure whether or not to remove the trick cause I haven't really checked if the problem still persist on heavy computations (last time I saw the problem was like 5 months ago), so I'm a bit lost on whether to remove it now or not.
Ehh, what's the worst that could happen? I'll remove the work-around for now and trust that #2 doesn't come back, already released the fix as 2.2.0 so the comments should come up correctly once you update.
Thank you @nasheomirro , works like a charm now 👍
Hey there,
Thank you for providing this library, it has been super helpful!
I just noticed that the JSDOC / Typescripts comments are dropped when using the
PolyRefFunction
type, here's a quick example:With a simple
React.forwardRef
, JSDOC/comments stay intact:But disappears when using the polyRef helper:
Do you know how to fix it or guide through a potential fix? I'm pretty new to TypeScript but happy to dig a bit more to help if pointed in the right direction ✌️
Here's the full gist, just in case: https://gist.github.com/Sliov/9966a3fd3ad5c886e6a192a563839284