forked from redux-saga/redux-saga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.d.ts
59 lines (49 loc) · 1.58 KB
/
utils.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {
Effect, TakeEffectDescriptor, PutEffectDescriptor,
RaceEffectDescriptor, CallEffectDescriptor, ForkEffectDescriptor,
SelectEffectDescriptor, ActionChannelEffectDescriptor
} from "./effects";
import {Predicate, Task} from "./types";
export const TASK: string;
export function noop(): void;
export const is: {
undef: Predicate<any>;
notUndef: Predicate<any>;
func: Predicate<any>;
number: Predicate<any>;
array: Predicate<any>;
promise: Predicate<any>;
iterator: Predicate<any>;
task: Predicate<any>;
take: Predicate<any>;
put: Predicate<any>;
observable: Predicate<any>;
buffer: Predicate<any>;
pattern: Predicate<any>;
};
interface Deferred<R> {
resolve(result: R): void;
reject(error: any): void;
promise: Promise<R>;
}
export function deferred<T, R>(props?: T): T & Deferred<R>;
export function arrayOfDeffered<T>(length: number): Deferred<T>[];
interface MockTask extends Task {
setRunning(running: boolean): void;
setResult(result: any): void;
setError(error: any): void;
}
export function createMockTask(): MockTask;
export const asEffect: {
take<T>(effect: Effect): TakeEffectDescriptor<T>;
put<T>(effect: Effect): PutEffectDescriptor<T>;
race(effect: Effect): RaceEffectDescriptor;
call(effect: Effect): CallEffectDescriptor;
cps(effect: Effect): CallEffectDescriptor;
fork(effect: Effect): ForkEffectDescriptor;
join(effect: Effect): Task;
cancel(effect: Effect): Task;
select(effect: Effect): SelectEffectDescriptor;
actionChannel<T>(effect: Effect): ActionChannelEffectDescriptor<T>;
cancelled(effect: Effect): {};
};