mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-05 16:10:11 +08:00
Merge pull request #1391 from butlersoftware/computed-polymorphism-fix
Fixed KnockoutComputed polymorphism
This commit is contained in:
Vendored
+4
-7
@@ -68,11 +68,8 @@ interface KnockoutComputedStatic {
|
||||
(options?: any): KnockoutComputed<any>;
|
||||
}
|
||||
|
||||
interface KnockoutComputed<T> extends KnockoutSubscribable<T>, KnockoutComputedFunctions<T> {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> {
|
||||
|
||||
dispose(): void;
|
||||
isActive(): boolean;
|
||||
getDependenciesCount(): number;
|
||||
@@ -100,8 +97,8 @@ interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObserva
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
valueHasMutated(): void;
|
||||
valueWillMutate(): void;
|
||||
valueHasMutated?:{(): void;};
|
||||
valueWillMutate?:{(): void;};
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
|
||||
@@ -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