File tree Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Expand file tree Collapse file tree 1 file changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -43,12 +43,31 @@ export type AsyncStateStatus =
4343 | 'success'
4444 | 'error' ;
4545
46- export type AsyncState < R > = {
47- status : AsyncStateStatus ;
48- loading : boolean ;
49- error : Error | undefined ;
50- result : R | undefined ;
51- } ;
46+ export declare type AsyncState < R > =
47+ | {
48+ status : 'not-requested' ;
49+ loading : false ;
50+ result : undefined ;
51+ error : undefined ;
52+ }
53+ | {
54+ status : 'loading' ;
55+ loading : true ;
56+ error : undefined ;
57+ result : undefined ;
58+ }
59+ | {
60+ status : 'success' ;
61+ loading : false ;
62+ error : undefined ;
63+ result : R ;
64+ }
65+ | {
66+ status : 'error' ;
67+ loading : false ;
68+ error : Error ;
69+ result : undefined ;
70+ } ;
5271type SetLoading < R > = ( asyncState : AsyncState < R > ) => AsyncState < R > ;
5372type SetResult < R > = ( result : R , asyncState : AsyncState < R > ) => AsyncState < R > ;
5473type SetError < R > = ( error : Error , asyncState : AsyncState < R > ) => AsyncState < R > ;
You can’t perform that action at this time.
0 commit comments