@@ -190,9 +190,7 @@ describe('queryFn base implementation tests', () => {
190190
191191 const thunk = endpoint . initiate ( endpointName )
192192
193- const result = ( await store . dispatch ( thunk ) ) satisfies
194- | undefined
195- | QuerySubState < any >
193+ const result : undefined | QuerySubState < any > = await store . dispatch ( thunk )
196194
197195 if ( endpointName . includes ( 'Throw' ) ) {
198196 expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
@@ -246,10 +244,10 @@ describe('queryFn base implementation tests', () => {
246244
247245 const thunk = endpoint . initiate ( endpointName )
248246
249- const result = ( await store . dispatch ( thunk ) ) satisfies
247+ const result :
250248 | undefined
251249 | { data : string }
252- | { error : string | SerializedError }
250+ | { error : string | SerializedError } = await store . dispatch ( thunk )
253251
254252 if ( endpointName . includes ( 'Throw' ) ) {
255253 expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
@@ -293,7 +291,7 @@ describe('queryFn base implementation tests', () => {
293291 {
294292 const thunk = withNeither . initiate ( 'withNeither' )
295293
296- const result = ( await store . dispatch ( thunk ) ) satisfies QuerySubState < any >
294+ const result : QuerySubState < any > = await store . dispatch ( thunk )
297295
298296 expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
299297
@@ -313,10 +311,10 @@ describe('queryFn base implementation tests', () => {
313311 {
314312 const thunk = mutationWithNeither . initiate ( 'mutationWithNeither' )
315313
316- const result = ( await store . dispatch ( thunk ) ) satisfies
314+ const result :
317315 | undefined
318316 | { data : string }
319- | { error : string | SerializedError }
317+ | { error : string | SerializedError } = await store . dispatch ( thunk )
320318
321319 expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
322320
@@ -325,6 +323,10 @@ describe('queryFn base implementation tests', () => {
325323 TypeError ( 'endpointDefinition.queryFn is not a function' ) ,
326324 )
327325
326+ if ( ! ( 'error' in result ) ) {
327+ expect . fail ( )
328+ }
329+
328330 expect ( result . error ) . toEqual (
329331 expect . objectContaining ( {
330332 message : 'endpointDefinition.queryFn is not a function' ,
@@ -419,9 +421,9 @@ describe('usage scenario tests', () => {
419421 it ( 'can wrap a service like Firebase and handle errors' , async ( ) => {
420422 const consoleErrorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( noop )
421423
422- const result = ( await storeRef . store . dispatch (
424+ const result : QuerySubState < any > = await storeRef . store . dispatch (
423425 api . endpoints . getMissingFirebaseUser . initiate ( 1 ) ,
424- ) ) satisfies QuerySubState < any >
426+ )
425427
426428 expect ( consoleErrorSpy ) . toHaveBeenCalledOnce ( )
427429
0 commit comments