2.2.0 vue-tsc component ref #5089
Replies: 7 comments
-
This is caused by the declaration file generated by element plus being too large (13k lines for el-select). |
Beta Was this translation helpful? Give feedback.
-
If it is only for type checking, you can choose not to emit declaration. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The refs declared in the template will be automatically mounted on the component instance, regardless of |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
There's a entire thread in typescript talked about this microsoft/TypeScript#47663, you can take a look. Long story shot you are generating the type declaration file but the type referenced from an external package which typescript cannot find ( and the ui lib's types are too big, so you have two separated issue). As @KazariEX mentioned you really don't need to emit the declarations as you are not building a library. So you could just change your typecheck script without Btw this is a pretty bad practice of using template refs. What you wanted to do probably can be done by props and events. @KazariEX I think this issue can be transferred to discussion since it's not a bug neither feature request. |
Beta Was this translation helpful? Give feedback.
-
btw forget to mention if you really want to emit the declarations, this should fix the first error const elSelectRef: Ref<type> = ref() but still, second issue is related to external dependency. |
Beta Was this translation helpful? Give feedback.
-
Vue - Official extension or vue-tsc version
2.2.0
VSCode version
1.96.0
Vue version
3.5.13
TypeScript version
5.7.2
System Info
package.json dependencies
No response
Steps to reproduce
pnpm i
pnpm build
What is expected?
Passed normally
What is actually happening?
Link to minimal reproduction
https://github.com/k983551019/volar-tsc/tree/main/volar-tsc
Any additional comments?
Encapsulation components
Beta Was this translation helpful? Give feedback.
All reactions