File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
packages/vue-query/src/__tests__ Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,19 @@ describe('setQueryData', () => {
9696
9797 expectTypeOf ( data ) . toEqualTypeOf < string | undefined > ( )
9898 } )
99+
100+ it ( 'should preserve updater parameter type inference when used in functions with explicit return types' , ( ) => {
101+ const queryKey = [ 'key' ] as DataTag < Array < string > , number >
102+ const queryClient = new QueryClient ( )
103+
104+ // Simulate usage inside a function with explicit return type
105+ // The outer function returns 'unknown' but this shouldn't affect the updater's type inference
106+ ; ( ( ) =>
107+ queryClient . setQueryData ( queryKey , ( data ) => {
108+ expectTypeOf ( data ) . toEqualTypeOf < number | undefined > ( )
109+ return data
110+ } ) ) satisfies ( ) => unknown
111+ } )
99112} )
100113
101114describe ( 'fetchInfiniteQuery' , ( ) => {
You can’t perform that action at this time.
0 commit comments