-
-
Notifications
You must be signed in to change notification settings - Fork 438
[v2.2.2] useAttrs type resolution failure #5183
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
Comments
+1 I have same problem too |
Workaround: const attrs = useAttrs() as import('vue').SetupContext['attrs']; // Record<string, unknown> |
@KazariEX yes, similar to |
The essence of this problem is that We will introduce some options to control these type inference at a fine-grained level, see #5135. |
@maxdzin You can use pnpm to patch it as a workaround. |
You can use it to close the feature that auto type inference for |
+1, I have the same problem. Using Vue 3.5.13 & Typescript 5.7.3. |
Until the fix for package.json {
"pnpm": {
"overrides": {
"@vue/language-core": "2.2.0"
}
}
} |
When can a fix for this issue be expected? |
Just wait for the next release. |
* Fix injection warning fix: add default to `useVolver()` injection * Provisional fix of `@vue/language-core` typescript bug of `useAttrs()` ref: vuejs/language-tools#5183 --------- Co-authored-by: Alessandro Bellesia <[email protected]>
Vue - Official extension or vue-tsc version
2.2.2
VSCode version
1.97.2
Vue version
3.5.13
TypeScript version
5.7.3
System Info
package.json dependencies
Steps to reproduce
pnpm typecheck
.What is expected?
Typecheck to be passed without errors.
What is actually happening?
Typecheck is failed with the error:
Link to minimal reproduction
https://stackblitz.com/edit/github-g74ymcux-eyg4pnvv
Any additional comments?
I encountered this problem with the latest version of vue-tsc in the Nuxt project with
nuxt/image
module enabled. What is interesting is that typecheck reported an error for this lineconst attrs = useAttrs()
in theNuxtImg.vue
component only, while it is seem OK for the same line in theApp.vue
component (but I assume it is just the same as foruseSlots()
, when typecheck shows errors randomly, not for all occurrences).The text was updated successfully, but these errors were encountered: