@@ -13,14 +13,14 @@ const baseQuery = fetchBaseQuery()
1313const api = createApi ( {
1414 baseQuery,
1515 endpoints : ( build ) => ( {
16- test : build . query < string , void > ( { query : ( ) => '' } ) ,
16+ getTest : build . query < string , void > ( { query : ( ) => '' } ) ,
1717 mutation : build . mutation < string , void > ( { query : ( ) => '' } ) ,
1818 } ) ,
1919} )
2020
2121describe ( 'union types' , ( ) => {
2222 test ( 'query selector union' , ( ) => {
23- const result = api . endpoints . test . select ( ) ( { } as any )
23+ const result = api . endpoints . getTest . select ( ) ( { } as any )
2424
2525 if ( result . isUninitialized ) {
2626 expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -89,7 +89,7 @@ describe('union types', () => {
8989 }
9090 } )
9191 test ( 'useQuery union' , ( ) => {
92- const result = api . endpoints . test . useQuery ( )
92+ const result = api . endpoints . getTest . useQuery ( )
9393
9494 if ( result . isUninitialized ) {
9595 expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -193,7 +193,7 @@ describe('union types', () => {
193193 }
194194 } )
195195 test ( 'useQuery TS4.1 union' , ( ) => {
196- const result = api . useTestQuery ( )
196+ const result = api . useGetTestQuery ( )
197197
198198 if ( result . isUninitialized ) {
199199 expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -285,7 +285,7 @@ describe('union types', () => {
285285 } )
286286
287287 test ( 'useLazyQuery union' , ( ) => {
288- const [ _trigger , result ] = api . endpoints . test . useLazyQuery ( )
288+ const [ _trigger , result ] = api . endpoints . getTest . useLazyQuery ( )
289289
290290 if ( result . isUninitialized ) {
291291 expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -376,7 +376,7 @@ describe('union types', () => {
376376 } )
377377
378378 test ( 'useLazyQuery TS4.1 union' , ( ) => {
379- const [ _trigger , result ] = api . useLazyTestQuery ( )
379+ const [ _trigger , result ] = api . useLazyGetTestQuery ( )
380380
381381 if ( result . isUninitialized ) {
382382 expectTypeOf ( result . data ) . toBeUndefined ( )
@@ -468,9 +468,9 @@ describe('union types', () => {
468468 } )
469469
470470 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 (
474474 undefined ,
475475 {
476476 selectFromResult : ( ) => ( { x : true } ) ,
@@ -493,13 +493,14 @@ describe('union types', () => {
493493 . parameter ( 0 )
494494 . not . toEqualTypeOf ( useQueryResultWithoutMethods )
495495
496- expectTypeOf ( api . endpoints . test . select ) . returns . returns . toEqualTypeOf <
496+ expectTypeOf ( api . endpoints . getTest . select ) . returns . returns . toEqualTypeOf <
497497 Awaited < ReturnType < typeof refetch > >
498498 > ( )
499499 } )
500500
501501 test ( 'useQueryState (with selectFromResult)' , ( ) => {
502- const result = api . endpoints . test . useQueryState ( undefined , {
502+
503+ const result = api . endpoints . getTest . useQueryState ( undefined , {
503504 selectFromResult ( {
504505 data,
505506 isLoading,
@@ -530,7 +531,7 @@ describe('union types', () => {
530531 } )
531532
532533 test ( 'useQuery (with selectFromResult)' , async ( ) => {
533- const { refetch, ...result } = api . endpoints . test . useQuery ( undefined , {
534+ const { refetch, ...result } = api . endpoints . getTest . useQuery ( undefined , {
534535 selectFromResult ( {
535536 data,
536537 isLoading,
@@ -559,7 +560,7 @@ describe('union types', () => {
559560 isError : false ,
560561 } ) . toEqualTypeOf ( result )
561562
562- expectTypeOf ( api . endpoints . test . select ) . returns . returns . toEqualTypeOf <
563+ expectTypeOf ( api . endpoints . getTest . select ) . returns . returns . toEqualTypeOf <
563564 Awaited < ReturnType < typeof refetch > >
564565 > ( )
565566 } )
@@ -732,15 +733,15 @@ describe('union types', () => {
732733
733734describe ( '"Typed" helper types' , ( ) => {
734735 test ( 'useQuery' , ( ) => {
735- const result = api . endpoints . test . useQuery ( )
736+ const result = api . endpoints . getTest . useQuery ( )
736737
737738 expectTypeOf <
738739 TypedUseQueryHookResult < string , void , typeof baseQuery >
739740 > ( ) . toEqualTypeOf ( result )
740741 } )
741742
742743 test ( 'useQuery with selectFromResult' , ( ) => {
743- const result = api . endpoints . test . useQuery ( undefined , {
744+ const result = api . endpoints . getTest . useQuery ( undefined , {
744745 selectFromResult : ( ) => ( { x : true } ) ,
745746 } )
746747
@@ -750,15 +751,15 @@ describe('"Typed" helper types', () => {
750751 } )
751752
752753 test ( 'useQueryState' , ( ) => {
753- const result = api . endpoints . test . useQueryState ( )
754+ const result = api . endpoints . getTest . useQueryState ( )
754755
755756 expectTypeOf <
756757 TypedUseQueryStateResult < string , void , typeof baseQuery >
757758 > ( ) . toEqualTypeOf ( result )
758759 } )
759760
760761 test ( 'useQueryState with selectFromResult' , ( ) => {
761- const result = api . endpoints . test . useQueryState ( undefined , {
762+ const result = api . endpoints . getTest . useQueryState ( undefined , {
762763 selectFromResult : ( ) => ( { x : true } ) ,
763764 } )
764765
@@ -768,7 +769,7 @@ describe('"Typed" helper types', () => {
768769 } )
769770
770771 test ( 'useQuerySubscription' , ( ) => {
771- const result = api . endpoints . test . useQuerySubscription ( )
772+ const result = api . endpoints . getTest . useQuerySubscription ( )
772773
773774 expectTypeOf <
774775 TypedUseQuerySubscriptionResult < string , void , typeof baseQuery >
0 commit comments