-
Notifications
You must be signed in to change notification settings - Fork 3k
Add prototype-patching operator modules #843
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
cc @IgorMinar @jeffbcross - i couldn't work out optional syntax here, might be the pumpkin pie hangover. |
Change from monolithic entry points to individual operators patching the protype.
275df8e
to
407aa9b
Compare
This confuses me. Is this to say that |
Perhaps it should be: import `@reactivex/rxjs/observable/fromPromise`; (NOTE: The |
Yes, correct, it doesn't exist until imported. Definitely like this better, it reads much more nicely 👍 import `@reactivex/rxjs/observable/fromPromise`; |
I'd go so far as to have it also export the fromPromise function (same for the others). So: import {fromPromise} from 'rxjs/observable/fromPromise';
fromPromise(makePromise()).subscribe(); or import {Observable} from 'rxjs/observable';
import 'rxjs/observable/fromPromise';
Observable.fromPromise(makePromise()).subscribe(); would both work. |
... well I guess it could export |
Could we export both |
No such rule, IMO. So I don't see why not. |
ad43681
to
f7ff6ee
Compare
f7ff6ee
to
356d4f4
Compare
observables => observable ✔️ |
LGTM. |
Merged as of 95279cc... VERY nice work, @robwormald, and great idea overall @IgorMinar @jeffbcross et al. |
👍 yay! |
@trxcllnt i like the idea of exporting fromPromise et al, but they're mostly static methods on classes (PromiseObservable.create) - should i just const fromPromise = PromiseObservable.create;
export {fromPromise} or is there something more clever i'm missing? |
Step one (broken into two commits - operators and statics) in modularization strategy.
Moves prototype patching into individual modules, so Observable prototype can be patched incrementally.
Before:
After:
Part two will be using TS 1.8's module-reopening functionality to patch the interface, at which point the stub methods will be removed from Observable.ts. Not implemented yet - see microsoft/TypeScript#5269 (comment)
Current side effect (minor) is that type-completion will show methods that have possibly not been imported yet.
Closes #750