From ab8fecb85f87f2acbad07f191be3ad6da67c4762 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 24 Oct 2017 10:26:29 -0700 Subject: [PATCH 1/2] operator/publishReplay.ts:give type args to higherOrder call operator/publishReplay delegates to operators/publishReplay. The call is correct — *one* of the three overloads will be called, and it doesn't matter which — but the compiler has to choose one overload. This change provides the type arguments explicitly so that the most general overload gets called. This results in the the correct return type, `OperatorFunction`. --- src/operator/publishReplay.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator/publishReplay.ts b/src/operator/publishReplay.ts index 735af72340..276dbcb433 100644 --- a/src/operator/publishReplay.ts +++ b/src/operator/publishReplay.ts @@ -24,5 +24,5 @@ export function publishReplay(this: Observable, bufferSize?: number, selectorOrScheduler?: IScheduler | OperatorFunction, scheduler?: IScheduler): Observable | ConnectableObservable { - return higherOrder(bufferSize, windowTime, selectorOrScheduler as any, scheduler)(this); + return higherOrder(bufferSize, windowTime, selectorOrScheduler as any, scheduler)(this); } From 9f651b55f719e6ccfa7ffcefe75459d1708581d1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Tue, 24 Oct 2017 10:26:29 -0700 Subject: [PATCH 2/2] fix: give type args to higherOrder call in src/operator/publishReplay.ts operator/publishReplay delegates to operators/publishReplay. The call is correct — *one* of the three overloads will be called, and it doesn't matter which — but the compiler has to choose one overload. Previously, the call didn't include type arguments, and the type of the one argument that would be used for inference, selectorOrScheduler, was of type `any`. So the compiler chose the first overload with four parameters. However, the return type of this overload is incorrect, whereas the return type of the third overload is correct. Provide the type arguments explicitly so that the last, most general overload gets called. This results in the the correct return type, `OperatorFunction`. Closes #2991 --- src/operator/publishReplay.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operator/publishReplay.ts b/src/operator/publishReplay.ts index 735af72340..276dbcb433 100644 --- a/src/operator/publishReplay.ts +++ b/src/operator/publishReplay.ts @@ -24,5 +24,5 @@ export function publishReplay(this: Observable, bufferSize?: number, selectorOrScheduler?: IScheduler | OperatorFunction, scheduler?: IScheduler): Observable | ConnectableObservable { - return higherOrder(bufferSize, windowTime, selectorOrScheduler as any, scheduler)(this); + return higherOrder(bufferSize, windowTime, selectorOrScheduler as any, scheduler)(this); }