-
-
Notifications
You must be signed in to change notification settings - Fork 426
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
Circular reference caused by <Comp v-bind="{ ...$attrs }">
as single root el
#5197
Comments
Hi @KazariEX, it took me quite some time to create this issue so I was quite bummed to see it just closed as duplicate. I'm trying to go from #5116 to an example that works, but I'm unable to. Reading:
https://stackblitz.com/edit/github-g8ym7afd-khku9qew?file=src%2Fcomponents%2FMyButton.vue I tried a new version in the repo above, is that what the solution is? Does all the slot/event/props inference still work? |
Sorry I'm too tired today, part of this issue is duplicate, while the other part can be simplified as: <template>
<Comp v-bind="{ ...$props, ...$attrs }" />
</template> About compiler / runtime issue please report at vuejs/core repo. |
A root level comment should resolve the problem: <template>
<!-- skip root el resolution -->
<Comp v-bind="{ ...$props, ...$attrs }" />
</template> |
This is also valid: <template>
<Comp v-bind="$attrs" :="$props" />
</template> Because |
<Comp v-bind="{ ...$attrs }">
as single root el
Thanks! Was able to resolve my issues for now with this solution, and using a simple Much appreciated |
Vue - Official extension or vue-tsc version
2.2.2
VSCode version
n/a
Vue version
3.5.13
TypeScript version
5.7.3
System Info
n/a
package.json dependencies
Steps to reproduce
For a long time I'm using wrapper components in my Vue project. On vue-tsc 2.1.0, I got no errors and my Vue application can build. With 2.2.2, I got a few ts errors (because of better type inference in the new version), but it is not possible to make both Vue and vue-tsc happy.
1. My starting point: vue-tsc 2.1.10
npx vue-tsc
reports no errors2. Simple upgrade to vue-tsc 2.2.2
npx vue-tsc
reports 2 errors3. Small rewrite to specifically define slot and emit types, via
InstanceType
npx vue-tsc
reports no errors4. Same as previous, but now using
vue-component-type-helpers
npx vue-tsc
reports no errors5. Same as previous, but now using complex types
npx vue-tsc
reports no errorsWhat is expected?
I was hoping for either 3 or 4 to work. Both 3 and 4 work great for type inference in my IDE (phpstorm), but I cannot get my app to build.
What is actually happening?
TS is happy, Vue is not.
Link to minimal reproduction
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: