-
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
Module Augmentation #1388
Module Augmentation #1388
Conversation
@@ -15,8 +15,9 @@ export class Subject<T> extends Observable<T> implements Observer<T>, Subscripti | |||
return new Subject<T>(destination, source); | |||
}; | |||
|
|||
constructor(protected destination?: Observer<T>, protected source?: Observable<T>) { | |||
constructor(protected destination?: Observer<T>, source?: Observable<T>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exposing source is expected changes in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually change the visibility of source
, since it is already a protected property. You're right though, in that it doesn't really seem like it belongs in this PR. It's probably something that crept in while I was fooling around with #1234. @david-driscoll will probably have to pull this out 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it is already a protected property.
: Yes, you're correct. I've missed inheritance.
Let's take this out. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that was unintentional (I was seeing a bug in my editor that was already fixed)
@kwonoj Yeah, this PR amalgamates the changes in both of those, alongside some changes that were only mentioned in comments (cleanup of Kitchensink to re-export from Rx, for example). Correct me if I'm wrong here @david-driscoll. |
Main question in here will be 'when' to check in this changes. I think it's ok to consider now since 1.8 is released, ng2 b7 is 1.8 friendly, so next release of RxJS will work with those mostly. cc @robwormald and @IgorMinar for visibility, to not proceed if that's incorrect expectation. Also, maybe we need commit message for 'breaking changes'? (not sure, this is non-api changes but prerequisite dependency changes) |
@@ -127,7 +20,7 @@ export type ObservableInput<T> = ObservableOrPromise<T> | ArrayOrIterator<T>; | |||
* | |||
* @class Observable<T> | |||
*/ | |||
export class Observable<T> implements CoreOperators<T> { | |||
export class Observable<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so interface coreoperators
and kitchensinkoperators
are gone completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are, I don't see a real need for them, though if we needed too we could bring them back I suppose. After all the file was, was a list of signatures and to an interface, which is what we've replaced with this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a real need for them
: In general I have similar feeling since I didn't have lot of cases of use interface to observable instead of observable itself but might be some usecases I couldn't think of. cc @Blesh for opinions.
Amazing work guys! 👏 👏 |
: Yes, I forgot to add this emoji... 👏 👍 |
3cac7f7
to
e037660
Compare
Seems Rx.TestScheduler is not exported in kitchensink? |
e037660
to
a979cdf
Compare
@kwonoj yeah... I was missing |
import './add/observable/throw'; | ||
import './add/observable/timer'; | ||
import './add/observable/zip'; | ||
export * from './Rx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure, but I think this might need to be import './Rx'
now, since the augmentations are treated as a side effect. They recently changed what gets emitted in declaration files from imports/exports; see microsoft/TypeScript#6835
EDIT: Same for Rx.KitchenSink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@masaeedu you saying we need to import and export it? If I just change it to import things break. If I only export, I get correct typings my editor, and everything seems to be working fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@david-driscoll Actually, I just realized this is a non-issue, since Rx
exports lots of stuff. The issue was that if you try to export * from 'foo'
, and foo
has important module augmentations but nothing exported, the export * from
will be elided from the definition file, and you lose the augmentations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha, so that means 👍 to me not being crazy! 😄
great stuff! 👏 cc @IgorMinar |
Very nice @david-driscoll! |
@kwonoj, can I lean on you to verify this change? |
@Blesh Sure. I already reviewed most of changes and mostly fine, was waiting good to go sign from you (and from ng2 also) - I'll respin verification and ping once it's ready to check in. |
will verify on our end tomorrow |
@robwormald cool, I'll finish verification on my end before then, can be aligned. |
Change looks good to me. @Blesh , one thing to be noted - as mentioned in here (#1388 (comment)) , now |
Remaining things
|
What's that? Also: @kwonoj I've added a label for "needs rebase". |
@Blesh nothing special - basically this change will make minimum requirement of TypeScript to 1.8.2. Check once again Angular 2 also bumps up minimum requirement before check in to avoid breaking build for further releases. I believe this won't happen but just in case to ensure. |
Use new external module augmentation feature to move Observable stubs into patch files. See ReactiveX#1193
a979cdf
to
a08fabf
Compare
@kwonoj @robwormald rebased |
Thanks, I'll check this in around later today. |
Merged with a08fabf, thanks @david-driscoll ! 🎉 |
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. |
This combines #1284 and #1288 with the latest additions to the signatures, and introduces "module augmentation" for use with Rx.
Thanks to @masaeedu for getting it going, this branch is just an extension of his work. 👏
In addition I was able to clean up
Rx.DOM.ts
andRx.KitchenSink.ts
, so that they simply exportRx.ts
, plus add the additional augmented items.cc @kwonoj @Blesh @staltz @luisgabriel