dderevjanik / wsdl-tsclient

:page_facing_up: Generate typescript client from WSDL
https://npm.im/wsdl-tsclient
MIT License
95 stars 70 forks source link

Compatibility with verbatimModuleSyntax tsc option #90

Open dzialdowski opened 1 month ago

dzialdowski commented 1 month ago

Now when using verbatimModuleSyntax we get an error: 'X' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled

It would be great if we can get an CLI option to import definitions with 'import type' instead of just 'import'

dderevjanik commented 1 month ago

Thank you for reporting this issue.

I understand your request regarding the use of import type with verbatimModuleSyntax enabled. However, I believe this might not be the right approach for wsdl-tsclient. As a generator, the primary purpose of wsdl-tsclient is to produce the necessary TypeScript code, without adhering to the specific formatting and linting rules of individual projects.

Consider a scenario where a project requires only type instead of interface, avoids using class, or has specific formatting rules such as spaces instead of tabs. Addressing each of these preferences within the generator could become impractical.

I recommend performing post-processing on the generated code to meet your project's formatting and linting standards. Automated tools can easily adjust the code to use import type instead of import, among other customizations. One effective approach is to create a separate project or library solely for generating the WSDL client, which can then be distributed via a private npm or GitHub repository.

That said, I will consider your suggestion and see if there is a feasible way to incorporate this option into wsdl-tsclient.

Thank you again for your feedback.