unjs / unimport

Unified utils for auto importing APIs in modules.
MIT License
513 stars 60 forks source link

Type errors with 3.10.0 in Vue template section (Nuxt project) #361

Closed Anton-Plagemann closed 1 month ago

Anton-Plagemann commented 1 month ago

Environment

Project info:


Reproduction

Let me know if you need a reproduction repo.

Describe the bug

Starting from unimport 3.10.0 I get type errors like these all over my nuxt app (see log section for a full example output): image

I tracked it down to the following code change (Line 84 to 91): https://github.com/unjs/unimport/compare/v3.9.1...v3.10.0#diff-ff328eec8d9ee3a30a4b685a1fe08482bc3edf274cba60669ce7869375d6d5e9

Reversing it make the errors disappear (using 3.9.1 does so too). Maybe it was removed by accident? The issue emerged, when I updated @nuxt/eslint from 0.4.0 to 0.5.0 which also updated unimport from 3.9.1 to 3.10.0.

Additional context

No response

Logs

Property 'useRoute' does not exist on type 'CreateComponentPublicInstance<Readonly<ExtractPropTypes<{}>>, { providerLogos: typeof providerLogos; t: typeof t; providerNames: typeof providerNames; auth: typeof auth; user: typeof user; redirectUrl: typeof redirectUrl; }, ... 17 more ..., {}>'.ts-plugin(2339)
byronogis commented 1 month ago

Check if you can reproduce the issue with other dependencies. I encountered the same problem when using the new version of peimvue, and I found a related issue at that time.

https://github.com/primefaces/primevue/issues/6199

Anton-Plagemann commented 1 month ago

Seems like this is caused by a change, how libraries augment the vue-type. See here for the reason and a temporary fix that worked for me. Closing this issue, as it seems there's nothing wrong with unimport 😊