Hi,
the TypeScript DTO generator currently creates an ambient module which can be used to obtain typing information. While this is great for many cases, its utility is somehow constrained for the following two reasons:
- The ambient module is not compiled to JavaScript. Enums that are used in DTOs will not be converted to JavaScript Objects and are therefore not usable (e.g. for assignment). We are currently getting around this by manually changing the ambient module to a real module, exporting all the interfaces and enums that we need and compiling it to JavaScript. Obviously this is not perfect, because we have to do that every time the contracts change.
- The ambient module only contains interfaces. If we want to new-up a DTO in our code it is not possible with just Interfaces. We have to create a new object and “cast” it to the respective interface.
It would be great if it was possible to generate a TypeScript Module that contained implementations instead of interfaces. With the current approach we have to do manual post-processing of the generated DTOs, while it would be great to just use the generated code without any modifications.
Thanks for helping us out