-
-
Notifications
You must be signed in to change notification settings - Fork 416
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
v2.0.22 regression on uni-app projects #4501
Comments
I think the deletion here caused this issue. The ts file I used below can solve some problems. type A = import('@vue/runtime-core').GlobalComponents;
declare module 'vue' {
interface GlobalComponents extends A {}
} |
Thank you for your help, but there are still some problems. I will use the following code as an example <el-button type="success" size="a">Success</el-button>
|
If you are using pnpm, you need to install @vue/runtime-core. |
Just want to provide a better solution i found, create a Note: If in mono repo, it will only work in the root level. |
Unfortunately, the deletion is intentional since TS 5.5 introduced some internal changes that make the old approach to detect if a module/type exists no longer work in TS 5.5. |
@zzh948498 I'm sorry I didn't conduct a complete investigation. I have updated the new solution, and it seems to work fine for me. type A = import('@vue/runtime-core').GlobalComponents;
declare module 'vue' {
interface GlobalComponents extends A {}
} |
Does this mean that @uni-helper/uni-app-types should tweak the TS type definitions it provides according to #4503 (comment)? or should I just wait for further tweaks and fixes from Volar? |
I solved the problem perfectly using this method .npmrc
or
tsconfig "vueCompilerOptions": {
"lib": "@vue/runtime-core",
}, |
I should put these code in which file? |
Wherever, as long as you include in tsconfig.json file |
我使用的这个,但是最后view 的类型是any ,全局组件的变成了unknowm |
For those who are stuck in uni-app types, please check https://github.com/uni-helper/uni-types. Also, check #4501 (comment) and https://github.com/vuejs/language-tools/wiki/Global-Component-Types. I am closing this issue. Please feel free to open another issue if you face problems and don't forget to provide a minimal reproduction. Thanks a lot to all of you guys. 🙏 |
Vue - Official extension or vue-tsc version
v2.0.22
VSCode version
v1.90.2
Vue version
v3.4.30
TypeScript version
v5.5.2
System Info
Steps to reproduce
Reload VSC window.
Check
src/pages/index/index.vue
and find out the types are lost.Link to minimal reproduction
/
Any additional comments?
I can confirm that v2.0.21 is fine, so that it may be caused by v2.0.22 #4492. If you guys can help me and point out how
@uni-helper/uni-app-types
should be tweaked, I'd appreciate it. Always thank you very much for the work you do! 🙏The text was updated successfully, but these errors were encountered: