fix(types): breaking type with auto imported components with Vue3 #2730
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
#2728 #2729
Reproduction
git clone https://github.com/Bernankez/pinia-types-repro.git cd pinia-types-repro pnpm install
Open
src/main.ts
and following the instructions.Environment
Node v20.15.0
VSCode v1.92.0
Vue.volar v2.0.28
Additional information
I found that the import order of
router
,App
andpinia
can effect theRouterView
type display in VSCode. If therouter
is imported first, then regardless of the order ofApp
andpinia
, the type ofRouterView
is always correct. If imported in the order ofApp
,pinia
,router
, the type ofRouterView
will also be correct. However, if imported in the order ofpinia
,App
,router
, the type ofRouterView
will beany
. I found that as mentioned in this PR, adding an empty GlobalComponents export can fix this issue, regardless of the import order. I'm not sure if it's a pinia issue, so temporarily mark it as a draft.