Skip to content

Commit

Permalink
refactor: use n-args for of scheduler signatures (#6081)
Browse files Browse the repository at this point in the history
* refactor: use n-args for of scheduler signatures

* chore: update api_guardian
  • Loading branch information
cartant authored Mar 8, 2021
1 parent db93093 commit 40e5c10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 64 deletions.
12 changes: 3 additions & 9 deletions api_guard/dist/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,10 @@ export interface Observer<T> {
next: (value: T) => void;
}

export declare function of(value: null): Observable<null>;
export declare function of(value: undefined): Observable<undefined>;
export declare function of(scheduler: SchedulerLike): Observable<never>;
export declare function of<T>(a: T, scheduler: SchedulerLike): Observable<T>;
export declare function of<T, T2>(a: T, b: T2, scheduler: SchedulerLike): Observable<T | T2>;
export declare function of<T, T2, T3>(a: T, b: T2, c: T3, scheduler: SchedulerLike): Observable<T | T2 | T3>;
export declare function of<T, T2, T3, T4>(a: T, b: T2, c: T3, d: T4, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4>;
export declare function of<T, T2, T3, T4, T5>(a: T, b: T2, c: T3, d: T4, e: T5, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5>;
export declare function of<T, T2, T3, T4, T5, T6>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6>;
export declare function of<T, T2, T3, T4, T5, T6, T7>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6 | T7>;
export declare function of<T, T2, T3, T4, T5, T6, T7, T8>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
export declare function of<T, T2, T3, T4, T5, T6, T7, T8, T9>(a: T, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, i: T9, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
export declare function of<A extends readonly unknown[]>(...args: [...A, SchedulerLike]): Observable<ValueFromArray<A>>;
export declare function of(): Observable<never>;
export declare function of<T>(): Observable<T>;
export declare function of<T>(value: T): Observable<T>;
Expand Down
64 changes: 9 additions & 55 deletions src/internal/observable/of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,18 @@ import { Observable } from '../Observable';
import { scheduleArray } from '../scheduled/scheduleArray';
import { popScheduler } from '../util/args';

// Devs are more likely to pass null or undefined than they are a scheduler
// without accompanying values. To make things easier for (naughty) devs who
// use the `strictNullChecks: false` TypeScript compiler option, these
// overloads with explicit null and undefined values are included.

export function of(value: null): Observable<null>;
export function of(value: undefined): Observable<undefined>;

/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of(scheduler: SchedulerLike): Observable<never>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T>(a: T, scheduler: SchedulerLike): Observable<T>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2>(a: T, b: T2, scheduler: SchedulerLike): Observable<T | T2>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3>(a: T, b: T2, c: T3, scheduler: SchedulerLike): Observable<T | T2 | T3>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4>(a: T, b: T2, c: T3, d: T4, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4, T5>(a: T, b: T2, c: T3, d: T4, e: T5, scheduler: SchedulerLike): Observable<T | T2 | T3 | T4 | T5>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4, T5, T6>(
a: T,
b: T2,
c: T3,
d: T4,
e: T5,
f: T6,
scheduler: SchedulerLike
): Observable<T | T2 | T3 | T4 | T5 | T6>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4, T5, T6, T7>(
a: T,
b: T2,
c: T3,
d: T4,
e: T5,
f: T6,
g: T7,
scheduler: SchedulerLike
): Observable<T | T2 | T3 | T4 | T5 | T6 | T7>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4, T5, T6, T7, T8>(
a: T,
b: T2,
c: T3,
d: T4,
e: T5,
f: T6,
g: T7,
h: T8,
scheduler: SchedulerLike
): Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */
export function of<T, T2, T3, T4, T5, T6, T7, T8, T9>(
a: T,
b: T2,
c: T3,
d: T4,
e: T5,
f: T6,
g: T7,
h: T8,
i: T9,
scheduler: SchedulerLike
): Observable<T | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
export function of<A extends readonly unknown[]>(...args: [...A, SchedulerLike]): Observable<ValueFromArray<A>>;

export function of(): Observable<never>;
/** @deprecated remove in v8. Do not use generic arguments directly, allow inference or cast with `as` */
Expand Down

0 comments on commit 40e5c10

Please sign in to comment.