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

How do I use overloading through inteface? #22

Open
thk-powertask opened this issue Mar 8, 2024 · 0 comments
Open

How do I use overloading through inteface? #22

thk-powertask opened this issue Mar 8, 2024 · 0 comments

Comments

@thk-powertask
Copy link

I am using nestjs, class-transformer, and plan to further customize it using ts-mapstruct.
I am trying to implement overloading with a method called of through an interface. How should I use it?

export interface OrderMapper {
    of(_source: Order): OrderInfo;
    of(_source: OrderItem): OrderItemInfo;
}

@Mapper()
export class OrderMapperImpl implements OrderMapper {
      of(_order: Order): OrderInfo;
      of(_order: OrderItem): OrderItemInfo;
    
      @Mappings()
      of(_source: Order | OrderItem): OrderInfo | OrderItemInfo {
          return ...
      }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant