Fixed KnockoutComputed polymorphism

Changed KnockoutComputed to inherit KnockoutObservable to enable
polymorphic/covariant reference conversion (see included unit test for
example).
This commit is contained in:
Thomas Butler
2013-12-06 06:10:12 -05:00
parent c4c51cfb72
commit b26095e9fa
2 changed files with 17 additions and 7 deletions
+13
View File
@@ -570,4 +570,17 @@ function test_misc() {
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
$(element).datepicker("destroy");
});
this.observableFactory = function(): KnockoutObservable<number>{
if (true) {
return ko.computed({
read:function(){
return 3;
}
});
} else {
return ko.observable(3);
}
}
}