Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!