You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...until either onSuccess or transform are defined
constdata=awaitupfetch('',{parseResponse: withZod(z.object({a: z.string()})),transform: (data)=>{// ❌ This fails, data is `any`expectTypeOf(data).toEqualTypeOf<{a: string}>()}})// ❌ This fails, data is `any`expectTypeOf(data).toEqualTypeOf<{a: string}>()
but it works fine when using the functional version of the fetcher options
When using a default parser the data type in the callbacks come from the default parser, not the fetcher's
constupfetch=up(fetch,()=>({parseResponse: ()=>1}))constdata=awaitupfetch('',{❌Erroron`parseResponse`parseResponse: withZod(z.object({a: z.string()})),transform: (data)=>{// ❌ This fails, data is `number`expectTypeOf(data).toEqualTypeOf<{a: string}>()},onSuccess: (data)=>{// ❌ This fails, data is `number`expectTypeOf(data).toEqualTypeOf<{a: string}>()}})// ❌ This fails, data is `any`expectTypeOf(data).toEqualTypeOf<{a: string}>()
Same thing with the functional options, it works fine
Using a non generic curried parser there is no issue
When using a curried parser everything is ok...
...until either
onSuccess
ortransform
are definedbut it works fine when using the functional version of the fetcher options
Also fine when unwrapping the curried function
When using a default parser the data type in the callbacks come from the default parser, not the fetcher's
Same thing with the functional options, it works fine
That's quite strange...
The text was updated successfully, but these errors were encountered: