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

Modify .tsx files during the build process to include additional TypeScript interfaces #351

Open
abdolian opened this issue Jul 19, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@abdolian
Copy link

I'm developing a Vite plugin that generates TypeScript interfaces and adds them to the end of each .tsx file during the build process. However, the output .d.ts files do not include the newly generated interfaces. How can I achieve this?

@qmhc
Copy link
Owner

qmhc commented Jul 23, 2024

There are some hook in plugin options. Are they useful in your situation?

@qmhc qmhc added the question Further information is requested label Jul 23, 2024
@abdolian
Copy link
Author

Dear @qmhc I believe that using hooks may not be beneficial in this context, as the process is fundamentally logical and does not require additional complexity.

It's important to note that Vite gives the paths of several .ts(x) files as input, and various plugins can modify the content of these files without modifying the original resources on disk.

Ultimately, the vite-plugin-dts plugin should generate .d.ts files based on the most recent changes made during the build process, rather than relying on the original file paths.

@qmhc
Copy link
Owner

qmhc commented Aug 21, 2024

Sadly, Typescript bases on real file system, this feature is hard to implement.

@qmhc qmhc added help wanted Extra attention is needed and removed question Further information is requested labels Aug 21, 2024
@abdolian
Copy link
Author

I believe that using the ts-morph npm package or similar approaches could significantly aid in implementing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants