Skip to content
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

fix(types): breaking type with auto imported components with Vue3 #2730

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

Bernankez
Copy link
Contributor

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 and pinia can effect the RouterView type display in VSCode. If the router is imported first, then regardless of the order of App and pinia, the type of RouterView is always correct. If imported in the order of App, pinia, router, the type of RouterView will also be correct. However, if imported in the order of pinia, App, router, the type of RouterView will be any. 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.

Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for pinia-playground ready!

Name Link
🔨 Latest commit 7b010b7
🔍 Latest deploy log https://app.netlify.com/sites/pinia-playground/deploys/66b1eced2ffd1a0008771053
😎 Deploy Preview https://deploy-preview-2730--pinia-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Aug 6, 2024

Deploy Preview for pinia-official canceled.

Name Link
🔨 Latest commit 7b010b7
🔍 Latest deploy log https://app.netlify.com/sites/pinia-official/deploys/66b1eced893ce100082e686e

@Bernankez Bernankez changed the title fix: breaking type with auto imported components fix(types): breaking type with auto imported components Aug 6, 2024
@Bernankez Bernankez changed the title fix(types): breaking type with auto imported components fix(types): breaking type with auto imported components with Vue3 Aug 6, 2024
Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.33%. Comparing base (a46a31e) to head (7b010b7).

Additional details and impacted files
@@           Coverage Diff           @@
##               v2    #2730   +/-   ##
=======================================
  Coverage   90.33%   90.33%           
=======================================
  Files          14       14           
  Lines        1335     1335           
  Branches      232      232           
=======================================
  Hits         1206     1206           
  Misses        128      128           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really curious, thanks a lot for opening the PR. I will give this a try, I wonder if it's because of the export... It feels so fragile 😓

@posva posva marked this pull request as ready for review August 6, 2024 11:48
Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to fix the issue with the order that doesn't work. Thanks again!

@posva posva merged commit 82ca41c into vuejs:v2 Aug 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants