Your comments

Hi there, I think the `clone()` function needs to be updated.

public clone(): this {

// 1) Create a new empty object with the same prototype as `this`

const clone = Object.create(Object.getPrototypeOf(this) as this;

// 2) all descriptors (enumerable + non-enumerable + symbol) - just in case

const descriptors = Object.getOwnPropertyDescriptors(this);

// 3) Copy all descriptors

Object.defineProperties(clone, descriptors);

// 4) Same approach for the component

const compClone = Object.create(Object.getPrototypeOf(this.component));

const compDescriptors = Object.getOwnPropertyDescriptors(this.component);

Object.defineProperties(compClone, compDescriptors);

clone.component = compClone;

// 5) Recreate the back-reference so it points to the clone, not the original

clone.circularReference = new ComponentWithBackReference(clone);

return clone;

}