Using derived stores in mutations
In svelte-query 5, it looks like using a derived store for
CreateMutationOptions
is supported based on the types and at runtime it works as expected. However, in TS land none of the generics seem to be working: https://codesandbox.io/p/sandbox/cocky-varahamihira-xdcnff?embed=1&file=%2Fsrc%2Flib%2Fmutations.ts%3A12%2C33
Is this a known issue or am I doing something wrong?cocky-varahamihira-xdcnff
CodeSandbox is an online editor tailored for web applications.

2 Replies
metropolitan-bronzeOP•3y ago
just noticed
createQuery
has a similar issue: when passed a derived store of options, the queryFn
won't have its queryKey
param typed (it'll be any
): https://codesandbox.io/p/sandbox/cocky-varahamihira-xdcnff?embed=1&file=%2Fsrc%2Flib%2Fqueries.ts%3A16%2C1cocky-varahamihira-xdcnff
CodeSandbox is an online editor tailored for web applications.
metropolitan-bronzeOP•3y ago
i was playing around with how fixing this might look, but ran into a bit of a wall here when typing the store args https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzjAnmApnASughgE1wCMAbdAGjij0NMwF84AzKCEOAcgGcA3dEmOgD0XGNHQcA3AChpQgFTzpceXAAqAZTgQAdiRRw+ULsF3L5Q6UwCuOgMYxTOuHeq5BG0GDIBZazHcnAB41AD4AClwoAHMuAC5EOBB-QN0AMR0E8IBKOABeUPVJbR0Nazs7dC4uAH4swgCEtVyCwwhgfDh6bISeds6EaQBIahhrKB0ZellXPA8vXxTHXXDBoeSA5Z0MnMRhkfQxib2h051cEHQEjjSICA5yffoZIfpHod0yiqquSJiuXJrA5HZxRWIAOnOlxeb2k3RkckU5jgGj4AkwonEhnQxic5ksNnsWxcbkEfk2wTC4WGYPi2BoxDIQSQG1S20ycF2rTUxU+5Uq1TqnIauCaLUKfQ6XVCjx6bSla1G40mcJmpPQ5LZ1IOBEZ6FW+1ZWx2gP2wOVJ1OQyhV04t3u71Ozyejr532qf1ipqtSuOtMhF3QL1e726sskQA
TS Playground - An online editor for exploring TypeScript and JavaS...
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.