-
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
fix(typings): fix subscribe overloads #3053
Conversation
Generated by 🚫 dangerJS |
Can we add typings tests for this? |
We can, but I don't think they'll test anything useful. What would be much better would be to add some snippet-based testing that could test for failures. It really needs a test to ensure that an Some snippet-based testing would be useful for testing other overloads, too. I discussed this with OJ in another issue - from this comment onwards. For another example of what the snippet tests would look like, have a look at If adding snippet testing infrastructure to RxJS is something you'd find agreeable, I can look into it. |
Okay... LGTM. I think that we should have a longer conversation about type testing. Perhaps with the TypeScript folks. I'm very interested in your solution, but it seems like TypeScript should provide more in this area. cc @david-driscoll |
@kwonoj do you think we should merge this into stable and cherry pick them over to master? I think so, personally. |
@cartant can you please rebase this against |
Remove the no-arg overload. If not removed, any Observable will be compatible with any ObservableInput regardless of type - as T does not appear in the no-arg overload. Closes ReactiveX#3052
@benlesh Rebased. |
The library is a fairly thin wrapper around TypeScript's Language Service API. In fact, it's pretty much based on the example in the referenced documentation. There are other snippet compiler libraries/tools out there, but I wasn't able to find one that supported importing modules. |
@benlesh yeah, seems non breaking change to me go for stable. |
Travis is failing for some reason on this can we figure out why? I'm going to rerun it. I'm looking at this from my phone so I couldn't really see the logs. |
It appears to be breaking because of the types that are installed for
I was able to get the tests to pass on Travis on my branch by clearing Travis's cache. How it gets into the state that it's currently in, I'm not sure. But it does seem cache-related. |
flushed cache and retriggered build, also created #3132 for better module cache. |
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. |
Remove the no-arg overload. If not removed, any Observable will be compatible with any ObservableInput regardless of type - as T does not appear in the no-arg overload.
Closes #3052
Description:
The overload signatures for
subscribe
include a signature that takes no parameters. This is a problem and results in anyObservable
being deemed compatible with anyObservableInput
.For example, this code will compile without error:
The problem is caused by
T
not appearing in the signature. The signature should be removed and theobserver
in the subsequent signature should be made optional. With that change, the compilation of the above code fails with this error:Related issue (if exists): #3052