Skip to content

After the vue component is assigned to another variable, the original jsDoc annotation in the variable's type declaration is deleted #5335

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

Open
shens3 opened this issue Apr 24, 2025 · 2 comments
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first need info

Comments

@shens3
Copy link

shens3 commented Apr 24, 2025

Vue - Official extension or vue-tsc version

Vue - Official extension: 2.2.10 ; vue-tsc:2.2.8

VSCode version

1.98.1

Vue version

3.5.13

TypeScript version

5.8.3

System Info

System:
    OS: macOS 13.2.1
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 200.01 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.volta/tools/image/node/22.11.0/bin/node
    Yarn: 1.22.22 - ~/.volta/tools/image/node/22.11.0/bin/yarn
    npm: 10.9.0 - ~/.volta/tools/image/node/22.11.0/bin/npm
  Browsers:
    Chrome: 135.0.7049.96
    Safari: 16.3
    Safari Technology Preview: 14.1

package.json dependencies

{
  "dependencies": {
    "vue": "^3.5.13"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.2.1",
    "@vue/tsconfig": "^0.7.0",
    "typescript": "~5.8.3",
    "vite": "^6.1.0",
    "vue-tsc": "^2.2.8"
  },
}

Steps to reproduce

Clone the repo, execute the following command

pnpm i 
pnpm build

In the src directory, the main.ts file references Component.vue, assigns it to MyComponent, and exports it as the default.

After executing the command, js and d.ts files corresponding to the src directory were generated in the dist directory. It can be found that in main.d.ts, the comments in the source code were deleted, while the comments were retained in Component.vue.d.ts.

main.d.ts

Image

Component.d.ts

Image

When importing components from main.js, the relevant information in jsdoc cannot be obtained.

The specific phenomenon can be viewed in the Test.vue file.

The difference can be seen <MyComponentFromDistReExport /> and <MyComponentFromDistSrc /> propWithoutDefault.

Image

Image

Also, whether prop has a default value will also affect whether the annotation can be displayed, you can see the <MyComponentFromDistSrc /> difference between propWithoutDefault and propWithDefault.

Image

Image

Miraculously, when using main.ts directly, everything works fine.

Image

Image

What is expected?

Hope all situations can make jsdoc display normally.

What is actually happening?

Jsdoc cannot be displayed normally in some cases.

Link to minimal reproduction

https://github.com/shens3/my-vue-app

Any additional comments?

When the vue component is compiled and published as an npm package for others to use, some parameter information may not be displayed properly to users.

@KazariEX
Copy link
Member

Does this version of Vue also have this problem?

@KazariEX KazariEX added need info good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first and removed pending triage labels Apr 24, 2025
@shens3
Copy link
Author

shens3 commented Apr 25, 2025

Does this version of Vue also have this problem?

Also have problems. Because the comments in main.d.ts have been deleted.

Image

Moreover, the jsdoc of Component.d.ts is no longer displayed. It could be displayed before.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first need info
Projects
None yet
Development

No branches or pull requests

2 participants