I have simple classes:
/// <reference path="..\typings\jquery\jquery.d.ts"/>
/// <reference path="..\typings\knockout\knockout.d.ts"/>
module Some.Namespace {
export class TestBase {
public field1: KnockoutObservable<string> = ko.observable("");
public onFieldChange: KnockoutComputed<string> = ko.computed(() => {
return this.field1();
}, this);
}
export class Test extends TestBase {
public field2: KnockoutObservable<string> = ko.observable("");
public onFieldChange() {
super.onFieldChange() + this.field2();
}
}
}
Problem, typescript doesn't allow to use keyword super in overridden method. It says:
Error 1 Class 'Some.Namespace.Test' cannot extend class 'Some.Namespace.TestBase': Class 'Some.Namespace.Test' defines instance member function 'onFieldChange', but extended class 'Some.Namespace.TestBase' defines it as instance member property.
Error 2 Only public methods of the base class are accessible via the 'super' keyword.
How can I override knockout computed method and don't loose base method?