-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
operator/publishReplay.ts:give type arguments to higherOrder call #2992
Conversation
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<T, R>`.
Generated by 🚫 dangerJS |
I couldn't use the commit-hook because it failed to find git.exe on my ancient windows laptop I use at home. I can update the commit message or produce an alternate PR tomorrow when I get back to my linux desktop at work. |
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<T, R>`. Closes ReactiveX#2991
…sn/rxjs into fix-compilation-on-ts-2.6
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
In src/operator/publishReplay.ts, the delegating call to higherOrder (which is an alias for publishReplay in src/operators/publishReplay.ts), has arguments that don't provide enough information to infer type arguments. That's because the third argument is cast to any, which is because it's just a delegation; a call to publishReplay could delegate to any of the three overloads of higherOrder. The compiler has to choose one, however, and it chooses the wrong one in Typescript 2.6.
This change provides the type arguments explicitly so that the most general overload gets called. This results in the the correct return type,
OperatorFunction<T, R>
.Related issue (if exists):
#2991