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
How can I pass any attribute to the component? Maybe something is wrong with my typescript configuratin, but I can't pass anything other then props that are provided by the component and a few common attributes like "style" as "key".
For example, if I try to pass the "src" value to a component, typescript gives the following error:
Type '{ class: string; src: string; }' is not assignable to type 'IntrinsicAttributes & { as?: AsTag | undefined; class?: unknown; readonly asChild?: boolean | undefined; key?: string | number | symbol | undefined; ref?: VNodeRef | undefined; ... 8 more ...; style?: unknown; }'.
Property 'src' does not exist on type 'IntrinsicAttributes & { as?: AsTag | undefined; class?: unknown; readonly asChild?: boolean | undefined; key?: string | number | symbol | undefined; ref?: VNodeRef | undefined; ... 8 more
When I use sfc template I can pass anything to the component, but with jsx I can't do that.
Thanks for the example, but in my case I have no control over the component.
I think I need to clarify the situation. I'm using the radix-vue library, which creates a component using Vue SFC. Since they are non-styled, I want to create a stylized wrapper, like shadcn-ui does. I decided to use JSX to do this, but I'm running into a situation where I can't pass the component anything other than the properties shown in the screenshot above. Basically no attributes.
Using the h() function, I can specify anything I want, since the type RawProps = VNodeProps & { .... } & Record<string, any>. So that's one I'm using for now.
How can I pass any attribute to the component? Maybe something is wrong with my typescript configuratin, but I can't pass anything other then props that are provided by the component and a few common attributes like "style" as "key".
For example, if I try to pass the "src" value to a component, typescript gives the following error:
When I use sfc template I can pass anything to the component, but with jsx I can't do that.
Here is my tsconfig.
Would appreciate any help 😄!
The text was updated successfully, but these errors were encountered: