-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Duplicate @tanstack/query-core causes type errors with Bun package manager #10426
Copy link
Copy link
Open
Description
Description
When using @tanstack/react-query@5.96.2 alongside packages that depend on @tanstack/query-core (e.g. @orpc/tanstack-query), Bun creates a nested duplicate of @tanstack/query-core inside node_modules/@tanstack/react-query/node_modules/, even when the versions are identical (both 5.96.2).
This causes TypeScript type errors because the two copies produce incompatible types (different QueryClient class instances from different module paths):
Type 'MutationObserverOptions<...>' is not assignable to type 'UseMutationOptions<...>'.
Types of property 'onError' are incompatible.
...
Property '#private' in type 'QueryClient' refers to a different member
that cannot be accessed from within type 'QueryClient'.
Reproduction
- Create a project with Bun as the package manager
- Install
@tanstack/react-query@^5.96.2and any package that depends on@tanstack/query-core(e.g.@orpc/tanstack-query) - Run
bun install - Observe
node_modules/@tanstack/react-query/node_modules/@tanstack/query-core/exists as a separate copy - TypeScript reports type incompatibilities between the two
QueryClientclasses
Expected behavior
@tanstack/query-core should be hoisted to a single copy in node_modules/@tanstack/query-core/, even when multiple packages depend on it.
Environment
- Bun: 1.3.9+
- @tanstack/react-query: 5.96.2
- @tanstack/query-core: 5.96.2 (duplicated)
- TypeScript: 6.0.2
Workaround
Adding @tanstack/query-core as a direct dependency or using "overrides" in package.json forces deduplication.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels