-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
4.2.0 - Type error when extending ComponentCustomProperties #1843
Comments
This shouln't be related to vue-router, but it seems like you need to extend vue itself in Vue 3.3 🤔 : declare module 'vue' {
interface ComponentCustomProperties {
$helloWorld: () => void;
}
} I think others have seen this problem in Nuxt and Vuetify so I will still give it a look and share with team. |
I explained how to solve this on version 4.2.0 here |
Thanks for this answer ! I have the same issue in my project using |
I imagine that if you have a package that used the runtime-core you would still see the problem 🤔 |
I use https://github.com/antfu/unplugin-vue-components, which generates a The weird thing is that it's working with Vue 3.3 and Vue Router 4.1.6, so maybe it's not only related to the new Vue version? |
I'm not sure if it's a problem here, but I'm using vue 3.3.1 and vue-router 4.2.0. I also made adjustments to the // declare module 'vue' {
declare module '@vue/runtime-core' {
// ...
} |
Is this a |
Is there a workaround, I'm also having the same issue, thanks |
Same problem here. We are using Vue 3.2. We are not using |
I tried the code from @cturconde In It indeed fixes the issue, but is of course not an acceptable solution. |
This has been the recommended approach for a while and supports more cases. See https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties for more information
I reverted the change until we can figure out a better rollout strategy for this change |
Reproduction
https://stackblitz.com/edit/vitejs-vite-9iezka?file=src/vue.d.ts
Steps to reproduce the bug
Using vite, create a d.ts file extending ComponentCustomProperties
Use
$route
or$router
in any component template.Try to build your code with npm run build
Expected behavior
When using vue-router 4.1.6, there is no compilation error.
Actual behavior
Here is the error durring code build :
Additional information
No response
The text was updated successfully, but these errors were encountered: