Skip to content
Source
Sign inSign up
TanStack/query

@types/node types leak into browser/client projects in version `5.91.0` #10294

Send to my agent
Closedziloen(GitHub profile, opens in a new tab) opened this issue 11 comments

Describe 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

  1. I can confirm, this is extremely annoying.

  2. 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.0 definitely plays a role:

      "resolutions": {
        "@tanstack/vue-query": "5.92.9",
        "@tanstack/query-core": "5.91.0"
      },
  3. TkDodo added labelstypes

  4. TkDodo added labelspackage: query-core

  5. TkDodo closed this

  6. 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

  7. 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"
    }
  8. TkDodo reopened this

  9. TkDodo closed this

  10. TkDodo reopened this

  11. TkDodocommented

    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

  12. TkDodo closed this

  13. @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 🤔

  14. @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.

  15. @ma-cote please have your agent file a PR to fix it 😂

Sign in to join this conversation.