-
Notifications
You must be signed in to change notification settings - Fork 91
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
Build .d.ts declaration files, comments are lost and duplicates are generated. #373
Comments
Sadly, this is a limitation of Volar. |
Volar? But I thought Volar shouldn't be just a plugin for an IDE? Are there any limitations on the declaration files it generates? |
You can use vue-tsc to generate the declaration files and see the limitation. |
I understand, because I tried it with vue-tsc and it did have the same effect, but there was no comment. Would it be more convenient if we could communicate in Chinese? |
Can we link the vue-tsc issue here? |
@Shinigami92 Sure. |
This is a problem in DefineComponent type. I don't have the energy to investigate at the moment. If anyone wants to deal with it, you can refer to my past PR: |
Looks like all 3 linked PRs are solved and merged. Is there something that needs to be done here? Or can the issue just get closed? |
Are these three PRs related to this issue? It seems that I have updated all packages to the latest version, but still failed to solve this problem. |
@qmhc Hello, do you have time recently? For the previous |
+1 |
Describe the bug
When I try to use vite-plugin-dts to build the .d.ts declaration file of the lib.
In the final result, my props and emits comments are lost.
In the Demo, you can intuitively see that there are no comments in the icon.d.ts file.
I suspect the error is because I define the props and emits objects in separate files, which is why the comments are lost.
So I tried to put props and emits definitions in the same file in the ContextMenu.tsx component.
In the Demo, you can intuitively see that there are comments in the contextMenu.d.ts file.
Maybe I think this is a bug. It's vite-plugin-dts that doesn't handle this situation well.
And there is another problem. I must have defined the icon.tsx component and also exported it by default in the file.
But in the root directory of the Icon component, I placed an index.ts file, which references the ./src/icon(.tsx) file to export and install the component name.
However, in the final index.d.ts file, it seems that the declaration of the icon.d.ts file is regenerated by default.
I think this effect did not meet my expectations.
Regarding the expectations of comments, I hope that no matter how I define these variables, I can include these comment information in the final .d.ts declaration file. Similar to
The expectation for the second question is actually optional. It just increases the file size after my lib mode packaging. However, it still needs to include comment information. The best expectation should be
Reproduction
https://stackblitz.com/edit/vite-build-dts-error-240823
Steps to reproduce
Run
npm install
followed bynpm run build
System Info
Validations
The text was updated successfully, but these errors were encountered: