When I deserialize an object using the JsonSerializer the type of the array change. When displaying the constructor.name of the array, the name become "bound Array".
And then overriding the push() method for example doesn't work:
const MYTYPE_SERIALIZER = new JsonSerializer(MyType)
console.log(data.myArray.constructor.name); // It display "Array"
let myType = MYTYPE_SERIALIZER.deserialize(data, true);
console.log(myType .myArray.constructor.name); // It display "bound Array"
let myArray = myType.myArray;
myArray.push = function () {
console.log("Debug");
return Array.prototype.push.apply(this, arguments);
}
myArray.push("Something"); // The console.log("Debug") will not be called
When I deserialize an object using the JsonSerializer the type of the array change. When displaying the constructor.name of the array, the name become "bound Array".
And then overriding the push() method for example doesn't work: