Inherit attributes with generic components causes type error
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
- Open a new Terminal after successful setup of dependencies
- Type and run
npm run typecheck
into the terminal - See an error in App.vue file
What is expected?
There is no error occurred
What is actually happening?
TS2345: Argument of type '{ dataCy: string; "data-cy": string; modelValue: "modelValue"; "onUpdate:modelValue": any; }' is not assignable to parameter of type '{ modelValue: "modelValue"; sameModel?: string | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps'.
Object literal may only specify known properties, and 'dataCy' does not exist in type '{ modelValue: "modelValue"; sameModel?: string | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps'.
System Info
No response
Any additional comments?
No response
Looks like its because of empty ComponentCustomProps interface
export interface ComponentCustomProps {
}
I've found a workaround, but it may have side effects
const props = defineProps<{
// allow other attributes
[attrs: string]: any
// props...
}>()