We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi. Congratulations on the lib, I was looking for a solution similar to Java's mapstruct for typeScript and I found yours.
I have a problem and maybe you can help me. When I have a nested object I can't mapper correctly.
My code:
class Event { event_id: string = "xpto"; product: Product = new Product; } class Product { id: Number = 0; name: string = "any-name"; } class Template { id: Number = 0; name: string = ""; } @Mapper({ sourceType: Product, targetType: Template }, [ { source: "name", target: "name" } ]) class ProductToTemplateMapper extends Converter<Product, Template> {} @Mapper({ sourceType: Event, targetType: Template }, [ { source: "event_id", target: "id"}, { source: "product", target: "name", converter: ProductToTemplateMapper} ]) class EventToTemplateMapper extends Converter<Event, Template> {} const event = new Event(); const mapper = new EventToTemplateMapper(); const template = mapper.convert(event); console.log(template);
the result is this: { id: 'xpto', name: Template { id: 0, name: 'any-name' } }
but I would like it to be: { id: 'xpto', name: 'any-name' } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi.
Congratulations on the lib, I was looking for a solution similar to Java's mapstruct for typeScript and I found yours.
I have a problem and maybe you can help me. When I have a nested object I can't mapper correctly.
My code:
the result is this:
{ id: 'xpto', name: Template { id: 0, name: 'any-name' } }
but I would like it to be:
{ id: 'xpto', name: 'any-name' } }
The text was updated successfully, but these errors were encountered: