@@ -13,14 +13,14 @@ const baseQuery = fetchBaseQuery()
13
13
const api = createApi ( {
14
14
baseQuery,
15
15
endpoints : ( build ) => ( {
16
- test : build . query < string , void > ( { query : ( ) => '' } ) ,
16
+ getTest : build . query < string , void > ( { query : ( ) => '' } ) ,
17
17
mutation : build . mutation < string , void > ( { query : ( ) => '' } ) ,
18
18
} ) ,
19
19
} )
20
20
21
21
describe ( 'union types' , ( ) => {
22
22
test ( 'query selector union' , ( ) => {
23
- const result = api . endpoints . test . select ( ) ( { } as any )
23
+ const result = api . endpoints . getTest . select ( ) ( { } as any )
24
24
25
25
if ( result . isUninitialized ) {
26
26
expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -89,7 +89,7 @@ describe('union types', () => {
89
89
}
90
90
} )
91
91
test ( 'useQuery union' , ( ) => {
92
- const result = api . endpoints . test . useQuery ( )
92
+ const result = api . endpoints . getTest . useQuery ( )
93
93
94
94
if ( result . isUninitialized ) {
95
95
expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -193,7 +193,7 @@ describe('union types', () => {
193
193
}
194
194
} )
195
195
test ( 'useQuery TS4.1 union' , ( ) => {
196
- const result = api . useTestQuery ( )
196
+ const result = api . useGetTestQuery ( )
197
197
198
198
if ( result . isUninitialized ) {
199
199
expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -285,7 +285,7 @@ describe('union types', () => {
285
285
} )
286
286
287
287
test ( 'useLazyQuery union' , ( ) => {
288
- const [ _trigger , result ] = api . endpoints . test . useLazyQuery ( )
288
+ const [ _trigger , result ] = api . endpoints . getTest . useLazyQuery ( )
289
289
290
290
if ( result . isUninitialized ) {
291
291
expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -376,7 +376,7 @@ describe('union types', () => {
376
376
} )
377
377
378
378
test ( 'useLazyQuery TS4.1 union' , ( ) => {
379
- const [ _trigger , result ] = api . useLazyTestQuery ( )
379
+ const [ _trigger , result ] = api . useLazyGetTestQuery ( )
380
380
381
381
if ( result . isUninitialized ) {
382
382
expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -468,9 +468,9 @@ describe('union types', () => {
468
468
} )
469
469
470
470
test ( 'queryHookResult (without selector) union' , async ( ) => {
471
- const useQueryStateResult = api . endpoints . test . useQueryState ( )
472
- const useQueryResult = api . endpoints . test . useQuery ( )
473
- const useQueryStateWithSelectFromResult = api . endpoints . test . useQueryState (
471
+ const useQueryStateResult = api . endpoints . getTest . useQueryState ( )
472
+ const useQueryResult = api . endpoints . getTest . useQuery ( )
473
+ const useQueryStateWithSelectFromResult = api . endpoints . getTest . useQueryState (
474
474
undefined ,
475
475
{
476
476
selectFromResult : ( ) => ( { x : true } ) ,
@@ -493,13 +493,14 @@ describe('union types', () => {
493
493
. parameter ( 0 )
494
494
. not . toEqualTypeOf ( useQueryResultWithoutMethods )
495
495
496
- expectTypeOf ( api . endpoints . test . select ) . returns . returns . toEqualTypeOf <
496
+ expectTypeOf ( api . endpoints . getTest . select ) . returns . returns . toEqualTypeOf <
497
497
Awaited < ReturnType < typeof refetch > >
498
498
> ( )
499
499
} )
500
500
501
501
test ( 'useQueryState (with selectFromResult)' , ( ) => {
502
- const result = api . endpoints . test . useQueryState ( undefined , {
502
+
503
+ const result = api . endpoints . getTest . useQueryState ( undefined , {
503
504
selectFromResult ( {
504
505
data,
505
506
isLoading,
@@ -530,7 +531,7 @@ describe('union types', () => {
530
531
} )
531
532
532
533
test ( 'useQuery (with selectFromResult)' , async ( ) => {
533
- const { refetch, ...result } = api . endpoints . test . useQuery ( undefined , {
534
+ const { refetch, ...result } = api . endpoints . getTest . useQuery ( undefined , {
534
535
selectFromResult ( {
535
536
data,
536
537
isLoading,
@@ -559,7 +560,7 @@ describe('union types', () => {
559
560
isError : false ,
560
561
} ) . toEqualTypeOf ( result )
561
562
562
- expectTypeOf ( api . endpoints . test . select ) . returns . returns . toEqualTypeOf <
563
+ expectTypeOf ( api . endpoints . getTest . select ) . returns . returns . toEqualTypeOf <
563
564
Awaited < ReturnType < typeof refetch > >
564
565
> ( )
565
566
} )
@@ -732,15 +733,15 @@ describe('union types', () => {
732
733
733
734
describe ( '"Typed" helper types' , ( ) => {
734
735
test ( 'useQuery' , ( ) => {
735
- const result = api . endpoints . test . useQuery ( )
736
+ const result = api . endpoints . getTest . useQuery ( )
736
737
737
738
expectTypeOf <
738
739
TypedUseQueryHookResult < string , void , typeof baseQuery >
739
740
> ( ) . toEqualTypeOf ( result )
740
741
} )
741
742
742
743
test ( 'useQuery with selectFromResult' , ( ) => {
743
- const result = api . endpoints . test . useQuery ( undefined , {
744
+ const result = api . endpoints . getTest . useQuery ( undefined , {
744
745
selectFromResult : ( ) => ( { x : true } ) ,
745
746
} )
746
747
@@ -750,15 +751,15 @@ describe('"Typed" helper types', () => {
750
751
} )
751
752
752
753
test ( 'useQueryState' , ( ) => {
753
- const result = api . endpoints . test . useQueryState ( )
754
+ const result = api . endpoints . getTest . useQueryState ( )
754
755
755
756
expectTypeOf <
756
757
TypedUseQueryStateResult < string , void , typeof baseQuery >
757
758
> ( ) . toEqualTypeOf ( result )
758
759
} )
759
760
760
761
test ( 'useQueryState with selectFromResult' , ( ) => {
761
- const result = api . endpoints . test . useQueryState ( undefined , {
762
+ const result = api . endpoints . getTest . useQueryState ( undefined , {
762
763
selectFromResult : ( ) => ( { x : true } ) ,
763
764
} )
764
765
@@ -768,7 +769,7 @@ describe('"Typed" helper types', () => {
768
769
} )
769
770
770
771
test ( 'useQuerySubscription' , ( ) => {
771
- const result = api . endpoints . test . useQuerySubscription ( )
772
+ const result = api . endpoints . getTest . useQuerySubscription ( )
772
773
773
774
expectTypeOf <
774
775
TypedUseQuerySubscriptionResult < string , void , typeof baseQuery >
0 commit comments