In my typescript/react application, I would like to be able to reuse DTOs that I have declared inside of NestJS in order to have them declared in one place.
Right now, I have created an npm package that is used as a dependency in both application, which is fine until I have to apply some decorators for properties in the DTO, which is something I can have without adding decorator support in my types npm package.
- Is this not a good practice and should I keep frontend and backend dtos separate?
- If it is a good practice: a) Should I add decorator support in my types package and just do it there? b) Is there a more elegant way to do this that I am not aware of?