Lets say, I want to add method to NgForm (class)
NgForm.prototype.markAsDirty = function (): void {
let f: NgForm = this;
Util.forEach(f.form.controls, (k, v: AbstractControl) => {
v.markAsDirty(false);
});
};
Is this somehow possible in typescript?
I am aware of:
- TypeScript add static helper to prototype of existing class
- Extending functionality in TypeScript
- Extending Object.prototype with TypeScript
but it works only for interfaces, not classes.