mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user