lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.16k stars 32 forks source link

createMutationKeys with schema does not expose type mutationFn like the createQueryKeys function does #63

Closed siteassist-benjamin closed 1 year ago

siteassist-benjamin commented 1 year ago

We need to access and reuse the mutationFn from one of the mutationKeys definitions. However the only property exposed by the library for createMutationKeys is the mutationKey.

This is not a problem with the createQueryKeys function - see examples below:

Screenshot 2023-05-15 at 12 07 14 Screenshot 2023-05-15 at 12 07 04

I have tried looking into where this would need to change but I am a little lost as the typing system is very complex. Any help would be deeply appreciated 🙏

lukemorales commented 1 year ago

@siteassist-benjamin the createMutationKeys types are in fact broken, it's a now issue #55 but I didn't have the time yet to fix it. I'll just close the issue as a duplicate of #55, but feel free to add any comments on that issue