@@ -190,9 +190,7 @@ describe('queryFn base implementation tests', () => {
190
190
191
191
const thunk = endpoint . initiate ( endpointName )
192
192
193
- const result = ( await store . dispatch ( thunk ) ) satisfies
194
- | undefined
195
- | QuerySubState < any >
193
+ const result : undefined | QuerySubState < any > = await store . dispatch ( thunk )
196
194
197
195
if ( endpointName . includes ( 'Throw' ) ) {
198
196
expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
@@ -246,10 +244,10 @@ describe('queryFn base implementation tests', () => {
246
244
247
245
const thunk = endpoint . initiate ( endpointName )
248
246
249
- const result = ( await store . dispatch ( thunk ) ) satisfies
247
+ const result :
250
248
| undefined
251
249
| { data : string }
252
- | { error : string | SerializedError }
250
+ | { error : string | SerializedError } = await store . dispatch ( thunk )
253
251
254
252
if ( endpointName . includes ( 'Throw' ) ) {
255
253
expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
@@ -293,7 +291,7 @@ describe('queryFn base implementation tests', () => {
293
291
{
294
292
const thunk = withNeither . initiate ( 'withNeither' )
295
293
296
- const result = ( await store . dispatch ( thunk ) ) satisfies QuerySubState < any >
294
+ const result : QuerySubState < any > = await store . dispatch ( thunk )
297
295
298
296
expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
299
297
@@ -313,10 +311,10 @@ describe('queryFn base implementation tests', () => {
313
311
{
314
312
const thunk = mutationWithNeither . initiate ( 'mutationWithNeither' )
315
313
316
- const result = ( await store . dispatch ( thunk ) ) satisfies
314
+ const result :
317
315
| undefined
318
316
| { data : string }
319
- | { error : string | SerializedError }
317
+ | { error : string | SerializedError } = await store . dispatch ( thunk )
320
318
321
319
expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
322
320
@@ -325,6 +323,10 @@ describe('queryFn base implementation tests', () => {
325
323
TypeError ( 'endpointDefinition.queryFn is not a function' ) ,
326
324
)
327
325
326
+ if ( ! ( 'error' in result ) ) {
327
+ expect . fail ( )
328
+ }
329
+
328
330
expect ( result . error ) . toEqual (
329
331
expect . objectContaining ( {
330
332
message : 'endpointDefinition.queryFn is not a function' ,
@@ -419,9 +421,9 @@ describe('usage scenario tests', () => {
419
421
it ( 'can wrap a service like Firebase and handle errors' , async ( ) => {
420
422
const consoleErrorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( noop )
421
423
422
- const result = ( await storeRef . store . dispatch (
424
+ const result : QuerySubState < any > = await storeRef . store . dispatch (
423
425
api . endpoints . getMissingFirebaseUser . initiate ( 1 ) ,
424
- ) ) satisfies QuerySubState < any >
426
+ )
425
427
426
428
expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
427
429
0 commit comments