Skip to content

Commit

Permalink
chore: move interfaces to operators/index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jakovljevic-mladen committed May 10, 2021
1 parent 4129f0a commit ddbac9e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 54 deletions.
42 changes: 0 additions & 42 deletions api_guard/dist/types/index.d.ts
Expand Up @@ -86,10 +86,6 @@ export declare class ConnectableObservable<T> extends Observable<T> {
refCount(): Observable<T>;
}

export interface ConnectConfig<T> {
connector: () => SubjectLike<T>;
}

export declare type Cons<X, Y extends readonly any[]> = ((arg: X, ...rest: Y) => any) extends (...args: infer U) => any ? U : never;

export declare function defer<R extends ObservableInput<any>>(observableFactory: () => R): Observable<ObservedValueOf<R>>;
Expand Down Expand Up @@ -370,11 +366,6 @@ export declare class ReplaySubject<T> extends Subject<T> {
next(value: T): void;
}

export interface RetryConfig {
count: number;
resetOnSuccess?: boolean;
}

export declare function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T>;

export declare class Scheduler implements SchedulerLike {
Expand All @@ -397,20 +388,6 @@ export interface SequenceError extends Error {

export declare const SequenceError: SequenceErrorCtor;

export interface ShareConfig<T> {
connector?: () => SubjectLike<T>;
resetOnComplete?: boolean;
resetOnError?: boolean;
resetOnRefCountZero?: boolean;
}

export interface ShareReplayConfig {
bufferSize?: number;
refCount: boolean;
scheduler?: SchedulerLike;
windowTime?: number;
}

export declare class Subject<T> extends Observable<T> implements SubscriptionLike {
closed: boolean;
hasError: boolean;
Expand Down Expand Up @@ -468,11 +445,6 @@ export declare type Tail<X extends readonly any[]> = ((...args: X) => any) exten

export declare type TeardownLogic = Subscription | Unsubscribable | (() => void) | void;

export interface ThrottleConfig {
leading?: boolean;
trailing?: boolean;
}

export declare function throwError(errorFactory: () => any): Observable<never>;
export declare function throwError(error: any): Observable<never>;
export declare function throwError(errorOrErrorFactory: any, scheduler: SchedulerLike): Observable<never>;
Expand All @@ -482,26 +454,12 @@ export interface TimeInterval<T> {
value: T;
}

export interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {
each?: number;
first?: number | Date;
meta?: M;
scheduler?: SchedulerLike;
with?: (info: TimeoutInfo<T, M>) => O;
}

export interface TimeoutError<T = unknown, M = unknown> extends Error {
info: TimeoutInfo<T, M> | null;
}

export declare const TimeoutError: TimeoutErrorCtor;

export interface TimeoutInfo<T, M = unknown> {
readonly lastValue: T | null;
readonly meta: M;
readonly seen: number;
}

export declare function timer(due: number | Date, scheduler?: SchedulerLike): Observable<0>;
export declare function timer(startDue: number | Date, intervalDuration: number, scheduler?: SchedulerLike): Observable<number>;
export declare function timer(dueTime: number | Date, unused: undefined, scheduler?: SchedulerLike): Observable<0>;
Expand Down
42 changes: 42 additions & 0 deletions api_guard/dist/types/operators/index.d.ts
Expand Up @@ -47,6 +47,10 @@ export declare function concatWith<T, A extends readonly unknown[]>(...otherSour

export declare function connect<T, O extends ObservableInput<unknown>>(selector: (shared: Observable<T>) => O, config?: ConnectConfig<T>): OperatorFunction<T, ObservedValueOf<O>>;

export interface ConnectConfig<T> {
connector: () => SubjectLike<T>;
}

export declare function count<T>(predicate?: (value: T, index: number) => boolean): OperatorFunction<T, number>;

export declare function debounce<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T>;
Expand Down Expand Up @@ -218,6 +222,11 @@ export declare function repeatWhen<T>(notifier: (notifications: Observable<void>
export declare function retry<T>(count?: number): MonoTypeOperatorFunction<T>;
export declare function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;

export interface RetryConfig {
count: number;
resetOnSuccess?: boolean;
}

export declare function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T>;

export declare function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T>;
Expand All @@ -233,9 +242,23 @@ export declare function sequenceEqual<T>(compareTo: Observable<T>, comparator?:
export declare function share<T>(): MonoTypeOperatorFunction<T>;
export declare function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;

export interface ShareConfig<T> {
connector?: () => SubjectLike<T>;
resetOnComplete?: boolean;
resetOnError?: boolean;
resetOnRefCountZero?: boolean;
}

export declare function shareReplay<T>(config: ShareReplayConfig): MonoTypeOperatorFunction<T>;
export declare function shareReplay<T>(bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export interface ShareReplayConfig {
bufferSize?: number;
refCount: boolean;
scheduler?: SchedulerLike;
windowTime?: number;
}

export declare function single<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
export declare function single<T>(predicate?: (value: T, index: number, source: Observable<T>) => boolean): MonoTypeOperatorFunction<T>;

Expand Down Expand Up @@ -287,6 +310,11 @@ export declare function tap<T>(next?: ((value: T) => void) | null, error?: ((err

export declare function throttle<T>(durationSelector: (value: T) => ObservableInput<any>, config?: ThrottleConfig): MonoTypeOperatorFunction<T>;

export interface ThrottleConfig {
leading?: boolean;
trailing?: boolean;
}

export declare function throttleTime<T>(duration: number, scheduler?: SchedulerLike, config?: import("./throttle").ThrottleConfig): MonoTypeOperatorFunction<T>;

export declare function throwIfEmpty<T>(errorFactory?: () => any): MonoTypeOperatorFunction<T>;
Expand All @@ -300,6 +328,20 @@ export declare function timeout<T, M = unknown>(config: Omit<TimeoutConfig<T, an
export declare function timeout<T>(first: Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export declare function timeout<T>(each: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;

export interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {
each?: number;
first?: number | Date;
meta?: M;
scheduler?: SchedulerLike;
with?: (info: TimeoutInfo<T, M>) => O;
}

export interface TimeoutInfo<T, M = unknown> {
readonly lastValue: T | null;
readonly meta: M;
readonly seen: number;
}

export declare function timeoutWith<T, R>(dueBy: Date, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;
export declare function timeoutWith<T, R>(waitFor: number, switchTo: ObservableInput<R>, scheduler?: SchedulerLike): OperatorFunction<T, T | R>;

Expand Down
6 changes: 0 additions & 6 deletions src/index.ts
Expand Up @@ -95,12 +95,6 @@ export { NEVER } from './internal/observable/never';

/* Types */
export * from './internal/types';
export { ConnectConfig } from './internal/operators/connect';
export { RetryConfig } from './internal/operators/retry';
export { ShareConfig } from './internal/operators/share';
export { ShareReplayConfig } from './internal/operators/shareReplay';
export { ThrottleConfig } from './internal/operators/throttle';
export { TimeoutConfig, TimeoutInfo } from './internal/operators/timeout';

/* Config */
export { config, GlobalConfig } from './internal/config';
12 changes: 6 additions & 6 deletions src/operators/index.ts
Expand Up @@ -16,7 +16,7 @@ export { concatAll } from '../internal/operators/concatAll';
export { concatMap } from '../internal/operators/concatMap';
export { concatMapTo } from '../internal/operators/concatMapTo';
export { concatWith } from '../internal/operators/concatWith';
export { connect } from '../internal/operators/connect';
export { connect, ConnectConfig } from '../internal/operators/connect';
export { count } from '../internal/operators/count';
export { debounce } from '../internal/operators/debounce';
export { debounceTime } from '../internal/operators/debounceTime';
Expand Down Expand Up @@ -70,15 +70,15 @@ export { raceWith } from '../internal/operators/raceWith';
export { reduce } from '../internal/operators/reduce';
export { repeat } from '../internal/operators/repeat';
export { repeatWhen } from '../internal/operators/repeatWhen';
export { retry } from '../internal/operators/retry';
export { retry, RetryConfig } from '../internal/operators/retry';
export { retryWhen } from '../internal/operators/retryWhen';
export { refCount } from '../internal/operators/refCount';
export { sample } from '../internal/operators/sample';
export { sampleTime } from '../internal/operators/sampleTime';
export { scan } from '../internal/operators/scan';
export { sequenceEqual } from '../internal/operators/sequenceEqual';
export { share } from '../internal/operators/share';
export { shareReplay } from '../internal/operators/shareReplay';
export { share, ShareConfig } from '../internal/operators/share';
export { shareReplay, ShareReplayConfig } from '../internal/operators/shareReplay';
export { single } from '../internal/operators/single';
export { skip } from '../internal/operators/skip';
export { skipLast } from '../internal/operators/skipLast';
Expand All @@ -95,11 +95,11 @@ export { takeLast } from '../internal/operators/takeLast';
export { takeUntil } from '../internal/operators/takeUntil';
export { takeWhile } from '../internal/operators/takeWhile';
export { tap } from '../internal/operators/tap';
export { throttle } from '../internal/operators/throttle';
export { throttle, ThrottleConfig } from '../internal/operators/throttle';
export { throttleTime } from '../internal/operators/throttleTime';
export { throwIfEmpty } from '../internal/operators/throwIfEmpty';
export { timeInterval } from '../internal/operators/timeInterval';
export { timeout } from '../internal/operators/timeout';
export { timeout, TimeoutConfig, TimeoutInfo } from '../internal/operators/timeout';
export { timeoutWith } from '../internal/operators/timeoutWith';
export { timestamp } from '../internal/operators/timestamp';
export { toArray } from '../internal/operators/toArray';
Expand Down

0 comments on commit ddbac9e

Please sign in to comment.