Skip to content

Commit

Permalink
refactor(scheduled): fix imports and some typings related to previous…
Browse files Browse the repository at this point in the history
… change
  • Loading branch information
benlesh committed Feb 26, 2019
1 parent 67e8121 commit 35d982f
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { canReportError } from './util/canReportError';
import { toSubscriber } from './util/toSubscriber';
import { iif } from './observable/iif';
import { throwError } from './observable/throwError';
import { observable as Symbol_observable } from '../internal/symbol/observable';
import { observable as Symbol_observable } from './symbol/observable';
import { pipeFromArray } from './util/pipe';
import { config } from './config';

Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/from.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../Observable';
import { subscribeTo } from '../util/subscribeTo';
import { ObservableInput, SchedulerLike, ObservedValueOf } from '../types';
import { scheduled } from 'rxjs/internal/scheduled/scheduled';
import { scheduled } from '../scheduled/scheduled';

export function from<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;
/** @deprecated use {@link scheduled} instead. */
Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/fromArray.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { subscribeToArray } from '../util/subscribeToArray';
import { scheduleArray } from 'rxjs/internal/scheduled/scheduleArray';
import { scheduleArray } from '../scheduled/scheduleArray';

export function fromArray<T>(input: ArrayLike<T>, scheduler?: SchedulerLike) {
if (!scheduler) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/fromIterable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { subscribeToIterable } from '../util/subscribeToIterable';
import { scheduleIterable } from 'rxjs/internal/scheduled/scheduleIterable';
import { scheduleIterable } from '../scheduled/scheduleIterable';

export function fromIterable<T>(input: Iterable<T>, scheduler?: SchedulerLike) {
if (!input) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/fromObservable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../Observable';
import { subscribeToObservable } from '../util/subscribeToObservable';
import { InteropObservable, SchedulerLike } from '../types';
import { scheduleObservable } from 'rxjs/internal/scheduled/scheduleObservable';
import { scheduleObservable } from '../scheduled/scheduleObservable';

export function fromObservable<T>(input: InteropObservable<T>, scheduler?: SchedulerLike) {
if (!scheduler) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/fromPromise.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '../Observable';
import { SchedulerLike } from '../types';
import { subscribeToPromise } from '../util/subscribeToPromise';
import { schedulePromise } from 'rxjs/internal/scheduled/schedulePromise';
import { schedulePromise } from '../scheduled/schedulePromise';

export function fromPromise<T>(input: PromiseLike<T>, scheduler?: SchedulerLike) {
if (!scheduler) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/observable/of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SchedulerLike } from '../types';
import { isScheduler } from '../util/isScheduler';
import { fromArray } from './fromArray';
import { Observable } from '../Observable';
import { scheduleArray } from 'rxjs/internal/scheduled/scheduleArray';
import { scheduleArray } from '../scheduled/scheduleArray';

/* tslint:disable:max-line-length */
/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
Expand Down
2 changes: 1 addition & 1 deletion src/internal/scheduled/scheduled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { schedulePromise } from './schedulePromise';
import { scheduleArray } from './scheduleArray';
import { scheduleIterable } from './scheduleIterable';
import { ObservableInput, SchedulerLike, Observable } from 'rxjs';
import { isInteropObservable } from 'rxjs/internal/util/isInteropObservable';
import { isInteropObservable } from '../util/isInteropObservable';
import { isPromise } from '../util/isPromise';
import { isArrayLike } from '../util/isArrayLike';
import { isIterable } from '../util/isIterable';
Expand Down
4 changes: 3 additions & 1 deletion src/internal/util/subscribeTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { isPromise } from './isPromise';
import { isObject } from './isObject';
import { iterator as Symbol_iterator } from '../symbol/iterator';
import { observable as Symbol_observable } from '../symbol/observable';
import { Subscription } from '../Subscription';
import { Subscriber } from '../Subscriber';

export const subscribeTo = <T>(result: ObservableInput<T>) => {
export const subscribeTo = <T>(result: ObservableInput<T>): (subscriber: Subscriber<T>) => Subscription | void => {
if (!!result && typeof result[Symbol_observable] === 'function') {
return subscribeToObservable(result as any);
} else if (isArrayLike(result)) {
Expand Down
5 changes: 2 additions & 3 deletions src/internal/util/subscribeToResult.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ObservableInput } from '../types';
import { Subscription } from '../Subscription';
import { InnerSubscriber } from '../InnerSubscriber';
import { OuterSubscriber } from '../OuterSubscriber';
import { Subscriber } from '../Subscriber';
import { subscribeTo } from './subscribeTo';
import { Observable } from 'rxjs/Rx';
import { Observable } from '../Observable';

export function subscribeToResult<T, R>(
outerSubscriber: OuterSubscriber<T, R>,
Expand All @@ -21,7 +20,7 @@ export function subscribeToResult<T, R>(
destination: Subscriber<any> = new InnerSubscriber(outerSubscriber, outerValue, outerIndex)
): Subscription | void {
if (destination.closed) {
return;
return undefined;
}
if (result instanceof Observable) {
return result.subscribe(destination);
Expand Down

0 comments on commit 35d982f

Please sign in to comment.