Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Issue after upgrading Angular 12 to Angular 13: a deepClone function works in version 12, but do not assign functions in version 13

I've recently updated angular version from 12 to 13. I have a class with a clone method. The implementation of the the class is something like this:

export class MyClass {

...

public clone(): MyClass {
   const newObject: MyClass = Util.deepClone(this);

   newObject.updateProperty();

   return newObject;
}

...

}

The deepClone method at Util class has the following implementation:

/**
   * Returns a deep copy of the object
   */
  public static deepClone(oldObj: any) {
    let newObj = oldObj;
    if (oldObj && typeof oldObj === 'object') {
      if (oldObj instanceof Date) {
        return new Date(oldObj.getTime());
      }
      newObj =
        Object.prototype.toString.call(oldObj) === '[object Array]' ? [] : {};
      for (const i in oldObj) {
        newObj[i] = this.deepClone(oldObj[i]);
      }
    }
    return newObj;
  }

My problem is: this piece of code works in version 12, but it doesn't in version 13. The function updateProperty() is undefined in version 13, but it is ok in version 12.

As I couldn't find anyone with similar issues neither similar questions, I would like some help to find:

  1. what changed from Angular 12 to Angular 13 that makes this piece of code stop working in version 13?
  2. how to solve the issue?
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda