@@ -24,10 +24,12 @@ export class SeamHttpRequest<
24
24
const TResponse ,
25
25
const TResponseKey extends keyof TResponse | undefined ,
26
26
> implements
27
- PromiseLike <
27
+ Promise <
28
28
TResponseKey extends keyof TResponse ? TResponse [ TResponseKey ] : undefined
29
29
>
30
30
{
31
+ readonly [ Symbol . toStringTag ] : string = 'SeamHttpRequest'
32
+
31
33
readonly #parent: SeamHttpRequestParent
32
34
readonly #config: SeamHttpRequestConfig < TResponseKey >
33
35
@@ -105,7 +107,7 @@ export class SeamHttpRequest<
105
107
return data
106
108
}
107
109
108
- then <
110
+ async then <
109
111
TResult1 = TResponseKey extends keyof TResponse
110
112
? TResponse [ TResponseKey ]
111
113
: undefined ,
@@ -123,8 +125,30 @@ export class SeamHttpRequest<
123
125
| ( ( reason : any ) => TResult2 | PromiseLike < TResult2 > )
124
126
| null
125
127
| undefined ,
126
- ) : PromiseLike < TResult1 | TResult2 > {
127
- return this . execute ( ) . then ( onfulfilled , onrejected )
128
+ ) : Promise < TResult1 | TResult2 > {
129
+ return await this . execute ( ) . then ( onfulfilled , onrejected )
130
+ }
131
+
132
+ async catch < TResult = never > (
133
+ onrejected ?:
134
+ | ( ( reason : any ) => TResult | PromiseLike < TResult > )
135
+ | null
136
+ | undefined ,
137
+ ) : Promise <
138
+ | ( TResponseKey extends keyof TResponse
139
+ ? TResponse [ TResponseKey ]
140
+ : undefined )
141
+ | TResult
142
+ > {
143
+ return await this . execute ( ) . catch ( onrejected )
144
+ }
145
+
146
+ async finally (
147
+ onfinally ?: ( ( ) => void ) | null | undefined ,
148
+ ) : Promise <
149
+ TResponseKey extends keyof TResponse ? TResponse [ TResponseKey ] : undefined
150
+ > {
151
+ return await this . execute ( ) . finally ( onfinally )
128
152
}
129
153
}
130
154
0 commit comments