Skip to content
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

$attrs or ReturnType<typeof useAttrs()> is always Datawhen fallthroughAttributes: true #5008

Closed
ferferga opened this issue Nov 15, 2024 · 0 comments · Fixed by #5011
Closed
Labels
feature request Request new features

Comments

@ferferga
Copy link
Contributor

Vue - Official extension or vue-tsc version

2.1.10

VSCode version

1.95.3

Vue version

3.5.12

TypeScript version

5.6.3

System Info

No response

package.json dependencies

"dependencies": {
  "vue": "3.5.12"
},
"devDependencies": {
  "@types/node": "22.9.0",
  "@vitejs/plugin-vue": "5.2.0",
  "typescript": "5.6.3",
  "vite": "5.4.11",
  "vue-tsc": "2.1.10"
}

Steps to reproduce

  1. Open the plaground link
  2. Hover over attrs: the type will be Data instead of ButtonHTMLAttributes
const attrs = useAttrs();
  1. Run npm run check: You will see that

What is expected?

The type of the fallthrough attributes should be Data when there is no v-bind="$attrs" assigned to an element. But when it is assigned, it should be of the assigned element's attributes type.

What is actually happening?

The type of the fallthrough attributes always is Data, both on useAttrs and $attrs.

Link to minimal reproduction

https://stackblitz.com/edit/vue3-vite-typescript-starter-aahszk?file=src%2Fcomponents%2FVButton.vue

Any additional comments?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants