@@ -146,9 +146,10 @@ class Observer {
146
146
if ( isHttpResponse ( response ) && ! response . ok ) {
147
147
shouldDismiss = false
148
148
const message =
149
- // @ts -expect-error
150
149
typeof data . error === 'function'
151
- ? await data . error ( `HTTP error! status: ${ response . status } ` )
150
+ ? await ( data . error as ( msg : string ) => Promise < string > ) (
151
+ `HTTP error! status: ${ response . status } `
152
+ )
152
153
: data . error
153
154
const description =
154
155
typeof data . description === 'function'
@@ -158,15 +159,17 @@ class Observer {
158
159
this . create ( { id, type : 'error' , message, description } )
159
160
} else if ( data . success !== undefined ) {
160
161
shouldDismiss = false
161
- // @ts -expect-error
162
162
const message =
163
163
typeof data . success === 'function'
164
- ? await data . success ( response )
164
+ ? await (
165
+ data . success as ( response : ToastData ) => Promise < string >
166
+ ) ( response )
165
167
: data . success
166
168
const description =
167
- // @ts -expect-error
168
169
typeof data . description === 'function'
169
- ? await data . description ( response )
170
+ ? await (
171
+ data . description as ( response : ToastData ) => Promise < string >
172
+ ) ( response )
170
173
: data . description
171
174
this . create ( { id, type : 'success' , message, description } )
172
175
}
@@ -175,15 +178,15 @@ class Observer {
175
178
result = [ 'reject' , error ]
176
179
if ( data . error !== undefined ) {
177
180
shouldDismiss = false
178
- // @ts -expect-error union type error
179
181
const message =
180
182
typeof data . error === 'function'
181
- ? await data . error ( error )
183
+ ? await ( data . error as ( error : unknown ) => Promise < string > ) ( error )
182
184
: data . error
183
- // @ts -expect-error union type error
184
185
const description =
185
186
typeof data . description === 'function'
186
- ? await data . description ( error )
187
+ ? await ( data . description as ( error : unknown ) => Promise < string > ) (
188
+ error
189
+ )
187
190
: data . description
188
191
this . create ( { id, type : 'error' , message, description } )
189
192
}
0 commit comments