You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this happens with both cloneDeep and compat.cloneDeep.
It is then affecting other functions like omit.
it('should work with custom classes',()=>{classCustomTest{constructor(publicvalue: number){}myFunc(){return`value is ${this.value}`;}}constobject=newCustomTest(1);constcloned=cloneDeep(object);expect(cloned).not.toBe(object);expect(cloned).toEqual(object);expect(cloned.myFunc()).toBe(object.myFunc());// <- Error: TypeError: cloned.myFunc is not a functionexpect(cloned.myFunc()).toEqual('value is 1');constnested={customTest: newCustomTest(1)};constclonedNested=cloneDeep(nested);expect(clonedNested).not.toBe(nested);expect(clonedNested).toEqual(nested);expect(clonedNested.customTest.myFunc()).toBe(nested.customTest.myFunc());expect(clonedNested.customTest.myFunc()).toEqual('value is 1');});
The text was updated successfully, but these errors were encountered:
eturino
changed the title
Bug: cloneDeep does not respect instances of classes
Bug: cloneDeep does not respect instances of classes (affects compat/omit and compat/pick)
Nov 7, 2024
this happens with both cloneDeep and compat.cloneDeep.
It is then affecting other functions like
omit
.The text was updated successfully, but these errors were encountered: