-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypings.d.ts
31 lines (25 loc) · 1010 Bytes
/
typings.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
type TSubscribe = (subscribeCallback: (value: any) => void) => void;
type TUnsubscribe = () => void;
interface ISource {
subscribe: TSubscribe;
}
interface IExtendedSource extends ISource {
catch: (error: any) => { subscribe: TSubscribe };
}
type IOperatorArgs = Partial<{
value: any;
next: (value: any) => void;
error: (errorValue: any) => void;
}>;
type IOperator = (args: IOperatorArgs) => TUnsubscribe;
export function pipe(
source: ISource,
...operators: IOperator[]
): IExtendedSource;
export function map(callback: (value: any) => any): IOperator;
export function filter(callback: (value: any) => any): IOperator;
export function promise(callback: (value: any) => Promise<any>): IOperator;
export function effect(callback: (value: any) => any): IOperator;
export function stream(callback: (value: any) => ISource): IOperator;
export function timeout(ms: number, onTick?: (value: any) => any): IOperator;
export function interval(ms: number, onTick?: (value: any) => any): IOperator;