diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index aa6044e9f4..b41846ca55 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -68,11 +68,8 @@ interface KnockoutComputedStatic { (options?: any): KnockoutComputed; } -interface KnockoutComputed extends KnockoutSubscribable, KnockoutComputedFunctions { - (): T; - (value: T): void; - - peek(): T; +interface KnockoutComputed extends KnockoutObservable, KnockoutComputedFunctions { + dispose(): void; isActive(): boolean; getDependenciesCount(): number; @@ -100,8 +97,8 @@ interface KnockoutObservable extends KnockoutSubscribable, KnockoutObserva (value: T): void; peek(): T; - valueHasMutated(): void; - valueWillMutate(): void; + valueHasMutated?:{(): void;}; + valueWillMutate?:{(): void;}; extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable; } diff --git a/knockout/tests/knockout-tests.ts b/knockout/tests/knockout-tests.ts index b0755c12af..fb39552415 100644 --- a/knockout/tests/knockout-tests.ts +++ b/knockout/tests/knockout-tests.ts @@ -570,4 +570,17 @@ function test_misc() { ko.utils.domNodeDisposal.addDisposeCallback(element, function () { $(element).datepicker("destroy"); }); + + this.observableFactory = function(): KnockoutObservable{ + if (true) { + return ko.computed({ + read:function(){ + return 3; + } + }); + } else { + return ko.observable(3); + } + } + } \ No newline at end of file