Open PratikDev opened 2 weeks ago
I'm mainly integrating shadcn and finding ts issues in the shadcn provided components. i'll try to keep adding all the issues i find in this comment
KeyboardEvent
is also not available.
I'm fairly certain KeyboardEvent
is part of TS's DOM typings, it's not something we'd supply? You might have misconfiguration your tsconfig.json
if it's not available.
Edit: Strange, React provides their own, but it seemingly matches the standard event? I guess we can just re-export it.
Isn't it like we'll re-export most of the unavailable types from react?
We don't re-export anything from React, no. We do not rely on React's types for our own.
It just makes little sense to me at this moment why React provides a KeyboardEvent
type, it seemingly matches the standard DOM type. See
maybe i'm too noob in TS world. but when u say re-export, do u mean to re-export from TS directly?
Yup, assuming I'm not missing something, I believe that's all we'd do.
I'm admittedly not a big TS user myself though.
u said react provides their own KeyboardEvent
. it's still unclear to me why they had to do it? and even if they do, why can't we just directly use this KeyboardEvent
without importing from anywhere? so that the one from TS gets used (i tried. it throws error).
u said react provides their own KeyboardEvent. it's still unclear to me why they had to do it?
No clue, feel free to look through the blame: source
why can't we just directly use this KeyboardEvent without importing from anywhere?
You absolutely can (and should) in user code, if it fits your needs. Won't work for libs though if they expect to pull that type from React.
Just met the same issue here, waiting for a solution.
Do you happen to have an example of a module that relies on the ElementRef
type? We'd supply it from preact/compat
, rather than preact
itself, but I'd like to test that our implementation is correct.
Thanks, was just looking for a specific component.
I took a look at this tonight, but looks like it might rely on #4113, which I'm not sure we can address.
Open to PRs, if anyone's got them though.
Describe the bug The
ElementRef
type is not available yetTo Reproduce Check this Stackblitz demo where i'm importing the
ElementRef
frompreact
. In the same linerender
is also imported. If you hover overrender
you'll see the type definition of it. But that's not the case forElementRef
. It doesn't show any type definition (idk why Stackblitz isn't showing any error there. but vscode does)Steps to reproduce the behavior:
npm init preact elementRefDemo
Typescript
when askedElementRef
insrc/index.ts
frompreact
orpreact/compact
Expected behavior
ElementRef
should be available inpreact
orpreact/compact