mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-30 12:50:40 +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:
1 parent
c4c51cfb72
commit
b26095e9fa
2 files changed
+17
-7
No files matched your search
@@ -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