Open China-xiaoFang opened 3 months ago
Sadly, this is a limitation of Volar.
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.
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?
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:
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 Issues
, I can customize the .d.ts
declaration file and replace the final duplicate file.
But there is a more urgent problem, which is the problem of jsDoc
document comments.
Because in many cases, I define props
emits
including slots
. So I can't put all the code in one file very elegantly, I need to reference it through different files.
So it also leads to that if it is defined in different files, the final generated .d.ts
declaration file does not actually have jsDoc
document comments, which is extremely inefficient for our developers.
I hope this jsDoc
document comment problem can be solved as soon as possible. Because it really affects me.
For this reason, I have re-provided a smaller Demo
. https://stackblitz.com/edit/vue-tsc-jsdoc-error
Thank you very much!
+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