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.18k stars 32 forks source link

refactor: replace internal types with `@tanstack/query-core` types #34

Closed wconnorwalsh closed 1 year ago

wconnorwalsh commented 1 year ago

Hello, I patched this locally, but figured I would also submit upstream.

This PR replaces the types marked internal in the most recent release with the actual types from @tanstack/query-core.

As of v1.0.3, the types marked internal are still being included in the build. When used in a project alongside TanStack Query, this duplication is causing TS to use the query-key-factory versions in place of (alongside?) the official TanStack types.

This PR should fix those issues and ensure any future changes to TanStack Query's types stay in sync with this package.

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: 094c3c02e866f67c6bebdf875c42a1b0414d48bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------------------------ | ----- | | @lukemorales/query-key-factory | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

lukemorales commented 1 year ago

Thanks for the PR @wconnorwalsh, I briefly considered that before the 1.0.3 release for fixing some issues, but even though the package is deeply connected to Tanstack Query, I'm a bit hesitant to introduce a peer dependency just for the sake of the QueryFunction types (I'm not strongly opinionated on this. I might be overthinking on this matter, but I'm not sure if I'd wanna lose the ability of adding this package to a project just for testing or in a monorepo as a package without needing to add another dependency for it to work). I know it's a bit more work on maintaining this package in sync with the original, but if there are changes to these types, they would probably be a breaking change anyways.

Could you share a bit more of what conflicts you have experienced? I'd be awesome if you can provide a reproduction as well