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

Module Augmentation #1388

Merged
merged 3 commits into from
Mar 10, 2016
Merged

Module Augmentation #1388

merged 3 commits into from
Mar 10, 2016

Conversation

david-driscoll
Copy link
Member

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 and Rx.KitchenSink.ts, so that they simply export Rx.ts, plus add the additional augmented items.

cc @kwonoj @Blesh @staltz @luisgabriel

@kwonoj
Copy link
Member

kwonoj commented Feb 24, 2016

#1284 and #1288 can be closed on behalf of this? (actually, noticed one of them closed already)

@@ -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>) {
Copy link
Member

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?

Copy link
Contributor

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 🙏

Copy link
Member

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. :)

Copy link
Member Author

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)

@masaeedu
Copy link
Contributor

@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.

@kwonoj
Copy link
Member

kwonoj commented Feb 24, 2016

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> {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@luisgabriel
Copy link
Contributor

Amazing work guys! 👏 👏

@kwonoj
Copy link
Member

kwonoj commented Feb 24, 2016

Amazing work guys!

: Yes, I forgot to add this emoji... 👏 👍

@david-driscoll david-driscoll force-pushed the augmentation branch 2 times, most recently from 3cac7f7 to e037660 Compare February 24, 2016 23:51
@kwonoj
Copy link
Member

kwonoj commented Feb 25, 2016

Seems Rx.TestScheduler is not exported in kitchensink?

@david-driscoll
Copy link
Member Author

@kwonoj yeah... I was missing TimeInterval, TestScheduler and VirtualTimeScheduler from the original file. Those have been added back in.

import './add/observable/throw';
import './add/observable/timer';
import './add/observable/zip';
export * from './Rx';
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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! 😄

@robwormald
Copy link
Contributor

great stuff! 👏

cc @IgorMinar

@benlesh
Copy link
Member

benlesh commented Mar 1, 2016

Very nice @david-driscoll!

@benlesh
Copy link
Member

benlesh commented Mar 1, 2016

@kwonoj, can I lean on you to verify this change?

@kwonoj
Copy link
Member

kwonoj commented Mar 1, 2016

@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.

@robwormald
Copy link
Contributor

will verify on our end tomorrow

@kwonoj
Copy link
Member

kwonoj commented Mar 1, 2016

@robwormald cool, I'll finish verification on my end before then, can be aligned.

@kwonoj
Copy link
Member

kwonoj commented Mar 1, 2016

Change looks good to me.

@Blesh , one thing to be noted - as mentioned in here (#1388 (comment)) , now CoreOperators and KitchenSinkOperators interfaces are removed by this PR. I don't see strong usecases of those interface since most of behaviors are based on Observable<T> itself so think it's ok but letting you know since there may be some reason it should exist.

@kwonoj kwonoj added the PR: lgtm label Mar 2, 2016
@kwonoj
Copy link
Member

kwonoj commented Mar 7, 2016

Remaining things

@benlesh
Copy link
Member

benlesh commented Mar 8, 2016

good to go sign from ng 2 for align release schedule

What's that?

Also: @kwonoj I've added a label for "needs rebase".

@kwonoj
Copy link
Member

kwonoj commented Mar 8, 2016

@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.

@kwonoj kwonoj removed the PR: lgtm label Mar 8, 2016
@david-driscoll
Copy link
Member Author

@kwonoj @robwormald rebased

@kwonoj
Copy link
Member

kwonoj commented Mar 9, 2016

Thanks, I'll check this in around later today.

@kwonoj kwonoj merged commit a08fabf into ReactiveX:master Mar 10, 2016
@kwonoj
Copy link
Member

kwonoj commented Mar 10, 2016

Merged with a08fabf, thanks @david-driscoll ! 🎉

@lock
Copy link

lock bot commented Jun 7, 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 7, 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.

None yet

6 participants