Skip to content
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

Merged
merged 3 commits into from
Oct 25, 2017

Conversation

sandersn
Copy link
Contributor

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

operator/publishReplay delegates to operators/publishReplay. The call is
correct &mdash; *one* of the three overloads will be called, and it
doesn't matter which &mdash; 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>`.
@rxjs-bot
Copy link

rxjs-bot commented Oct 24, 2017

Warnings
⚠️

commit message does not follows conventional change log (1)

Messages
📖

(1) : RxJS uses conventional change log to generate changelog automatically. It seems some of commit messages are not following those, please check contributing guideline and update commit messages.

CJS: 2276.4KB, global: 746.3KB (gzipped: 120.0KB), min: 145.7KB (gzipped: 31.2KB)

Generated by 🚫 dangerJS

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.399% when pulling ab8fecb on sandersn:fix-compilation-on-ts-2.6 into 6dc1b80 on ReactiveX:master.

@sandersn
Copy link
Contributor Author

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 &mdash; *one* of the three overloads will be called, and it
doesn't matter which &mdash; 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
@coveralls
Copy link

coveralls commented Oct 24, 2017

Coverage Status

Coverage remained the same at 97.399% when pulling ab8fecb on sandersn:fix-compilation-on-ts-2.6 into 6dc1b80 on ReactiveX:master.

@benlesh benlesh merged commit 0753ff7 into ReactiveX:master Oct 25, 2017
@sandersn sandersn deleted the fix-compilation-on-ts-2.6 branch October 25, 2017 15:47
@lock
Copy link

lock bot commented Jun 6, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants