@types/node types leak into browser/client projects in version `5.91.0` #10294
Send to my agentDescribe the bug#
After upgrading to the latest version of @tanstack/react-query, Node.js types appear to be leaking into browser/client-side TypeScript projects.
Your minimal, reproducible example#
https://stackblitz.com/edit/vitejs-vite-mkibrcm9?file=src%2Fmain.tsx&view=editor
Steps to reproduce#
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const timer = setTimeout(() => {}, 0)
// ^? NodeJS.Timeout
Expected behavior#
const timer = setTimeout(() => {}, 0)
// ^? number
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
@tanstack/react-query@5.91.0
Tanstack Query adapter#
react-query
TanStack Query version#
5.91.0
TypeScript version#
5.9.3
Additional context#
No response
Somehow the following won't be enough to fix it for me:
"resolutions": { "@tanstack/query-core": "5.90.20" },despite that:
$ yarn why @tanstack/query-core ├─ @tanstack/vue-query@npm:5.92.12 │ └─ @tanstack/query-core@npm:5.90.20 (via npm:5.90.20) │ └─ @tanstack/vue-query@npm:5.92.12 [94de9] └─ @tanstack/query-core@npm:5.90.20 (via npm:5.90.20)and I have to resort to:
"resolutions": { "@tanstack/vue-query": "5.92.9" },The following doesn't work either so
@tanstack/query-core 5.91.0definitely plays a role:"resolutions": { "@tanstack/vue-query": "5.92.9", "@tanstack/query-core": "5.91.0" },TkDodo added labelstypes
TkDodo added labelspackage: query-core
it seems to be this:
no idea yet how that got here though ...
could be this:
@lachlancollins FYI
TkDodo closed this
This issue still exists in the latest version (5.95.0).
I can still reproduce it here: https://stackblitz.com/edit/vitejs-vite-mkibrcm9?file=src%2Fmain.tsx&view=editor
I can confirm it's still not fixed. Even worse the previous resolutions aren't enough anymore. I've got to add more resolutions:
"resolutions": { "@tanstack/vue-query": "5.92.9", "@tanstack/query-devtools": "5.93.0" }TkDodo reopened this
TkDodo closed this
TkDodo reopened this
issue is still there 😭. Anyone else want to take a stab at it?
/edit: hah, I think I got something that works. And by “I” I mean AI
TkDodo closed this
@TkDodo Thanks for the fix! The problem is gone for
@tanstack/react-query@5.95.2, but I can still reproduce the issue with@tanstack/react-query-devtools@5.95.2🤔@TkDodo
If it can help, I spent a bit of time with Claude on this. Here's the result:
The culprit is commit 67cf8b60d — ref: ts cutoff (#10253) by Dominik Dorfmeister, dated 2026-03-09.
What changed: In scripts/getTsupConfig.js (symlinked as root.tsup.config.js in each package), it switched from dts: true to experimentalDts: true for both modernConfig and legacyConfig.
Why this causes the issue:
- dts: true — standard TypeScript declaration emit, scoped to the entry files in src/
- experimentalDts: true — uses a rollup-based DTS bundler that generates _tsup-dts-rollup.d.ts and inadvertently sweeps in root-level config files (tsup.config.ts, vite.config.ts), pulling their import { Options } from 'tsup' and import { UserConfig } from 'vite' into the published types
The vite import chain leads to /// <reference types="node" />, which globally loads @types/node and overrides the DOM setTimeout return type from number to NodeJS.Timeout for all consumers.
@ma-cote please have your agent file a PR to fix it 😂
Sign in to join this conversation.
I can confirm, this is extremely annoying.