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 committed 2013-12-06 06:10:12 -05:00
1 parent c4c51cfb72
commit b26095e9fa
2 files changed
+17 -7

No files matched your search

+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);
}
}
}