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

Unneeded writing of interface files #373

Open
Revest117 opened this issue Jul 7, 2022 · 3 comments
Open

Unneeded writing of interface files #373

Revest117 opened this issue Jul 7, 2022 · 3 comments
Labels
enhancement New feature or request ts-interface-generator Related to the ts-interface-generator sub-package

Comments

@Revest117
Copy link

As the project I am working on grows, more and more gen.d.ts files are generated. These files are generated every time I save while the ts interface generator is in watch mode. This causes a "spam" of messages in the terminal that eats up the newly generated gen.d.ts, the error messages and other messages.

I would recommend generating all interfaces only at the beginning and then only the files that have changed.

@akudev
Copy link
Contributor

akudev commented Jul 8, 2022

@Revest117 This was an obvious improvement idea from the very beginning and there is actually already code that identifies the changed files (did I mention I hate the prettifier-enforced formatting?).

I'm just not sure whether the solution is as simple as it looks at first glance: can you always easily say what changed? Couldn't changes in a superclass or in other classes or even UI5 itself require a change in a *.gen.d.ts file of an untouched control?

Out of curiosity: about how many generated files and about how much time per generation run are we talking here? We haven't done a load test with many complex files yet.

@akudev akudev added the ts-interface-generator Related to the ts-interface-generator sub-package label Jul 8, 2022
@akudev
Copy link
Contributor

akudev commented Jul 8, 2022

Actually, https://github.com/SAP/ui5-typescript/blob/main/packages/ts-interface-generator/DEVELOPMENT.md#in-practice has some thoughts on this as well and some change detection details.

@akudev akudev added the enhancement New feature or request label Jul 20, 2022
@Revest117
Copy link
Author

Revest117 commented Aug 22, 2022

Currently about 25 .gen.d.ts files are created. It only takes a second, maybe more if my PC is more loaded. The main problem is simply finding the error/warning messages after a few generation cycles in watch mode. In some cases I didn't even notice the warning message because it was pushed up with "Writing interface file: xyz" messages.

I agree that the solution cannot be that simple. But I have an idea to keep the terminal output to a minimum, namely an option to allow only errors/warnings as terminal output.

Currently:

>Writing interface file: xyz
...
>For the type 'abc' an import is created with module name 'cde', using its default export. Is this correct?
Usually this indicates some kind of issue. Maybe this import will also show up as error in your code editor.
The cause of this could be that the type 'abc' is referenced somewhere in Class 'DocumentManager', but is mis-spelled or does actually not exist.
>Writing interface file: cde
...
>Writing interface file: xyz

For a minimum example:

>For the type 'abc' an import is created with module name 'cde', using its default export. Is this correct?
Usually this indicates some kind of issue. Maybe this import will also show up as error in your code editor.
The cause of this could be that the type 'abc' is referenced somewhere in Class 'DocumentManager', but is mis-spelled or does actually not exist.
Writing interface file: cde

>Successfully written XX interface files (6160ms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ts-interface-generator Related to the ts-interface-generator sub-package
Projects
None yet
Development

No branches or pull requests

2 participants