File tree 1 file changed +13
-0
lines changed
packages/vue-query/src/__tests__
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,19 @@ describe('setQueryData', () => {
96
96
97
97
expectTypeOf ( data ) . toEqualTypeOf < string | undefined > ( )
98
98
} )
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
+ } )
99
112
} )
100
113
101
114
describe ( 'fetchInfiniteQuery' , ( ) => {
You can’t perform that action at this time.
0 commit comments