1

I need to get the data from the database and just pass the interface data to the response, but what the interface should omit continues to appear

type ITeste = Omit<Entity.Entity, 'billing_country_id'>;
    
    @injectable()
    export default class Find {
      constructor(
        @inject('DocumentHeaderRepository')
        private documentHeaderRepository: Entity.IRepository,
      ) {}
    
      public async execute(data: Entity.IFindRequest): Promise<ITeste[]> {
        const result = await this.documentHeaderRepository.find(data);
        return result;
      }
    }

    // what i'm getting...
    
       "response":[
{
    "billing_country_id": "d3d2f794-9271-4205-80c8-5ea273d85f57",
    "billing_country_name": "Portugal",
    "billing_locality": "Pontes",
    billing_postal_code": "2910-137"}
]
    

    // what i need
        


     "response":[
{
        "billing_country_name": "Portugal",
        "billing_locality": "Pontes",
         "billing_postal_code": "2910-137"}
]
  • 1
    You have to do this explicitly. Interfaces don't exist at runtime. See the answers to the linked question for more information. – jcalz Jul 27 '22 at 18:27

0 Answers0