-
Notifications
You must be signed in to change notification settings - Fork 3k
Added better typings for combineAll and combineLatest #715
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
Conversation
I tried to try out this changes locally but interestingly with this changes I'm not able to build (tsc stucks), seems travis also does. Just by reading changes there seems not quite suspicious though - anything have in mind? |
Probably something small, I'll look at later tonight. That said I'm looking
|
Ergonomics wise I like the idea itself, but also want to try out some small code snippets myself before add some comments :) One small concern currently I have is it makes type definition bit increased and would like to have some fancy way such as automating, etcs but can discuss it in further. |
So on my way home, I had an idea, that will automate the extraction of the methods, I've updated the branch with that now. Interestingly after I changed around the properties a bunch of typing issues popped up that had to be resolved. Still a work in progress, at the moment. |
267d4ae
to
db39135
Compare
…r typings stay in sync
db39135
to
b165ec3
Compare
I just noticed and interesting side effect, build times and memory consumption have dropped dramatically with these changes. Which honestly worries me, because I'm not entirely sure why. Now that said all tests pass, so it maybe that the typescript compiler is having an easier time reasoning about the generics after the changes.
|
39275ee
to
9d71a5c
Compare
9d71a5c
to
957dc06
Compare
2bbbbf6
to
b7ee18c
Compare
So... I wasn't planning on making this a huge PR but things just kind of evolved. No actual code was harmed in the making of this Pull Request... just strictly the TypeScript declarations. This now lets types flow more easily between different chains of code, making it so that as a TypeScript consumer of the library, you should rarely have to specify generic type arguments, they should be inferred for you automatically in most cases. |
7916ef0
to
e142528
Compare
e142528
to
469e6f6
Compare
b0db43b
to
14cb006
Compare
… ConnectableObservable
14cb006
to
36707ef
Compare
Seeing PR's growing up, including changes outer scope of original operator |
Things just kind of snowballed due to how the existing operators are I'm totally open to trying to isolate the changes, and break it down into On Mon, Nov 16, 2015 at 5:18 PM, OJ Kwon [email protected] wrote:
|
A agree with @kwonoj the scope of this PR has gotten really large. 123 files and 17 commits. It's really hard to follow all of that and would take forever to review the changes in earnest. I still haven't had time to grok what the crux of this PR is. On the surface, it appears to be refactoring type information and interfaces for TypeScript, but there is so much red and green I can't follow what each change is. |
: I think these can be address after core of this PR lands into master, can be handled with per each cases. If you don't mind, would you able to reduce PR's scope very core of changes with small examples? You may even does not have to modify current codebase heavily for proposal PRs, such as #643 did creating stub codes for simplify changes to discuss. |
Absolutely, I'll see if I can find a good minimum case to get started with later tonight. |
I like the spirit of this PR, and I'd love to see it broken into smaller PRs, but I'm going to close this PR for now, because it's just too big to merge. Really, I'd like just one PR to start with, so I can wrap my head around the change and why it's necessary. Creating an Issue on the matter might help as well. @david-driscoll This was a TON of work, and I really appreciate that, do you think you can port the work into smaller bites to make it easier for us to get a handle on what the changes are? Thanks again for being awesome. |
I was busy the last bit with other things, but yeah, I plan to split it up into more consumable pieces, hopefully tonight or tomorrow. |
I'm just checking the temperature here to see what the feels are of this change before I go and fix everything. I went around and fixed all the typings to allow for better type inference in RxJS 3/4 and was exploring using RxJS 5, and ran into some type inference issues with the current declarations.
At first I thought it would be possible to just get the types right on each command simply use
typeof abc
everywhere, sadly for instance methods that are not specifically defined on a class, that can't be done :(.Once we get microsoft/TypeScript#3694, it might be possible, but I don't know if that will fix what we're looking for.
I feel like the
CoreOperators<T>
andObservable<T>
changes could be automated, by adding it to the build. Basically the only difference betweensrc/operators/combineLatest
andObservable<T>.combineLatest
is thatT
comes from the Observable class, instead of being a generic type. We could easily make some code that strips outexport function abc<T...
and transpose it toabc: <...