File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
packages/toolkit/src/query Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,7 @@ export interface ApiEndpointQuery<
412
412
// eslint-disable-next-line @typescript-eslint/no-unused-vars
413
413
Definitions extends EndpointDefinitions
414
414
> {
415
+ name : string
415
416
/**
416
417
* All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
417
418
*/
@@ -425,6 +426,7 @@ export interface ApiEndpointMutation<
425
426
// eslint-disable-next-line @typescript-eslint/no-unused-vars
426
427
Definitions extends EndpointDefinitions
427
428
> {
429
+ name : string
428
430
/**
429
431
* All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
430
432
*/
@@ -603,6 +605,7 @@ export const coreModule = (): Module<CoreModule> => ({
603
605
safeAssign (
604
606
anyApi . endpoints [ endpointName ] ,
605
607
{
608
+ name : endpointName ,
606
609
select : buildQuerySelector ( endpointName , definition ) ,
607
610
initiate : buildInitiateQuery ( endpointName , definition ) ,
608
611
} ,
@@ -612,6 +615,7 @@ export const coreModule = (): Module<CoreModule> => ({
612
615
safeAssign (
613
616
anyApi . endpoints [ endpointName ] ,
614
617
{
618
+ name : endpointName ,
615
619
select : buildMutationSelector ( ) ,
616
620
initiate : buildInitiateMutation ( endpointName ) ,
617
621
} ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
import { server } from './mocks/server'
19
19
import { rest } from 'msw'
20
20
import { SerializeQueryArgs } from '../defaultSerializeQueryArgs'
21
+ import { string } from 'yargs'
21
22
22
23
const originalEnv = process . env . NODE_ENV
23
24
beforeAll ( ( ) => void ( ( process . env as any ) . NODE_ENV = 'development' ) )
@@ -43,6 +44,9 @@ test('sensible defaults', () => {
43
44
return { url : `user/${ id } ` }
44
45
} ,
45
46
} ) ,
47
+ updateUser : build . mutation < unknown , void > ( {
48
+ query : ( ) => '' ,
49
+ } ) ,
46
50
} ) ,
47
51
} )
48
52
configureStore ( {
@@ -60,6 +64,9 @@ test('sensible defaults', () => {
60
64
expectType < TagTypes > ( ANY as never )
61
65
// @ts -expect-error
62
66
expectType < TagTypes > ( 0 )
67
+
68
+ expect ( api . endpoints . getUser . name ) . toBe ( 'getUser' )
69
+ expect ( api . endpoints . updateUser . name ) . toBe ( 'updateUser' )
63
70
} )
64
71
65
72
describe ( 'wrong tagTypes log errors' , ( ) => {
You can’t perform that action at this time.
0 commit comments