-
-
Notifications
You must be signed in to change notification settings - Fork 484
Closed
Labels
Description
Hello! I encountered the following situation: for vue components that wrap native html elements, all properties not specified in props
automatically fall into attrs
and can be applied to a native html element. However, volar indicates a typescript error, since properties not specified in props
are missing from the type.
The problem occurs in the following cases:
- When using native html attributes on a component
- When a component wraps another component (WrapperComponent -> RootComponent). In this case, attributes not specified in props of WrapperComponent are passed to the attrs of RootComponent
Thus, the attributes are passed as intended, but the IDE displays a type error
Example:
// example.tsx
import { defineComponent } from 'vue'
const VButton = defineComponent(
() => {
return () => <button type="button">My button</button>
},
{
props: {
something: String
}
}
)
const usage = () => <VButton something="ok value" onClick={alert()} />

Info:
TypeScript Vue Plugin (Volar) v1.8.8
How can I eliminate the display of such errors?
Thanks!
so1ve, smarlhens and pont1s