Closed wangmumu0601 closed 4 weeks ago
It's recommended to use the following method to declare global directives:
declare module 'vue' {
interface GlobalDirectives {
vGlobal: Directive<HTMLElement, ...>;
}
}
It's recommended to use the following method to declare global directives:
declare module 'vue' { interface GlobalDirectives { vGlobal: Directive<HTMLElement, ...>; } }
thanks, it don't work also. but I use npm update --force
to get newer node_modules, so the problem is solved
Vue - Official extension or vue-tsc version
2.1.6
VSCode version
1.94.2
Vue version
3.4.21
TypeScript version
~5.5.4
System Info
package.json dependencies
Steps to reproduce
Here’s a suggested addition to your bug report under the Steps to reproduce section:
Steps to Reproduce:
Create a new Vue 3 project with TypeScript enabled.
Define custom directives in env.d.ts as follows:
Install the vue-official extension in Visual Studio Code and update to version 2.1.6.
Use the custom directives v-admin-disabled and v-admin-show in any Vue component template:
Hover over v-admin-disabled in the template and observe that the type is incorrectly inferred as any.
What is expected?
The custom directives vAdminDisabled and vAdminShow should be correctly inferred by TypeScript as
Directive<HTMLElement, never> | undefined
when hovering over them in the template. I get this picture on vue-official version 2.1.4What is actually happening?
i got
any
on vue-official version 2.1.6.<div v-admin-disabled>
is also never workLink to minimal reproduction
https://github.com/wangmumu0601/vue-official-debug
Any additional comments?
Since my English is not very good, I used GPT to help write this report. Thank you for your understanding, and I hope this issue can be resolved soon.
i have already delete
Vetur
before.ohhhh, it works on: vue@3.5 and vue-official version 2.1.6 vue@3.4 and vue-official version 2.1.4
just don't work on vue@3.4 and vue-official2.1.6