I use a extend() function to extend a object:
function extend(obj: Object, extension: Object) {
for (var key in obj) {
try {
extension[key] = obj[key];
} catch (e) {
console.error(e);
}
}
}
And there is a class Observer() hava a method Update() and a object check which is HTMLInputElement type.
class Observer {
Update(value) { }
}
var check:HTMLInputElement = document.createElement("input");
I use extend() function to extend checkbox,so it would have the method Update().
extend(new Observer(), check);
check.Update = function(value) {
this.checked = value;
}
And then cause error TS2339:Property 'Update' does not exist on type 'HTMLInputElement'

How to Fixed this error? Change the extend() function?