File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
packages/toolkit/src/tests Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -856,6 +856,37 @@ describe('type tests', () => {
856856 } ,
857857 } )
858858 } )
859+ test ( 'creators can be provided during createSlice call but cannot overlap' , ( ) => {
860+ const createAppSlice = buildCreateSlice ( {
861+ creators : { asyncThunk : asyncThunkCreator } ,
862+ } )
863+
864+ createAppSlice ( {
865+ name : 'counter' ,
866+ initialState : 0 ,
867+ creators : {
868+ something : asyncThunkCreator ,
869+ } ,
870+ reducers : ( create ) => {
871+ expectTypeOf ( create ) . toHaveProperty ( 'asyncThunk' )
872+ expectTypeOf ( create ) . toHaveProperty ( 'something' )
873+ return { }
874+ } ,
875+ } )
876+
877+ createAppSlice ( {
878+ name : 'counter' ,
879+ initialState : 0 ,
880+ // @ts -expect-error
881+ creators : {
882+ asyncThunk : asyncThunkCreator ,
883+ } ,
884+ reducers : ( create ) => {
885+ expectTypeOf ( create ) . toHaveProperty ( 'asyncThunk' )
886+ return { }
887+ } ,
888+ } )
889+ } )
859890} )
860891
861892interface Toast {
You can’t perform that action at this time.
0 commit comments