Skip to content

Inherit attributes with generic components causes type error #8372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
grindpride opened this issue May 19, 2023 · 5 comments
Closed

Inherit attributes with generic components causes type error #8372

grindpride opened this issue May 19, 2023 · 5 comments

Comments

@grindpride
Copy link

grindpride commented May 19, 2023

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-nwkbil?file=package.json,src%2Fcomponents%2FListGeneric.vue,src%2FApp.vue,src%2Fcomponents%2FList.vue

Steps to reproduce

  1. Open a new Terminal after successful setup of dependencies
  2. Type and run npm run typecheck into the terminal
  3. 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

@grindpride
Copy link
Author

grindpride commented May 19, 2023

Looks like its because of empty ComponentCustomProps interface

export interface ComponentCustomProps {
}

@Bernard-Borg
Copy link

bump - need this please

@stafyniaksacha
Copy link

stafyniaksacha commented Aug 12, 2023

I've found a workaround, but it may have side effects

const props = defineProps<{
  // allow other attributes
  [attrs: string]: any

  // props...
}>()

@DreamShaded
Copy link

any news?

@grindpride
Copy link
Author

No longer reproduced on [email protected]

@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants