Skip to content

TypeScript error importing node:async_hooks #14042

@Methuselah96

Description

@Methuselah96

Reproduction

  1. Clone https://github.com/Methuselah96/react-router-tsc-error (this is just the Vite template with react-router installed and skipLibCheck set to false)
  2. Run npm run build

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13500
    Memory: 6.43 GB / 31.65 GB
  Binaries:
    Node: 22.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 4.9.2 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.9 - C:\Program Files\nodejs\pnpm.CMD
    bun: 1.1.0 - ~\.bun\bin\bun.EXE
  Browsers:
    Edge: Chromium (131.0.2903.70)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    react-router: ^7.7.0 => 7.7.0
    vite: ^7.0.4 => 7.0.5

Used Package Manager

npm

Expected Behavior

No type errors.

I am using react-router only for the browser, so I don't think I should have to install @types/node, since I'm not using Node.

Actual Behavior

Type errors:

node_modules/react-router/dist/development/browser-CcxeZJcQ.d.mts:1:35 - error TS2307: Cannot find module 'node:async_hooks' or its corresponding type declarations.

1 import { AsyncLocalStorage } from 'node:async_hooks';
                                    ~~~~~~~~~~~~~~~~~~

node_modules/react-router/dist/development/index.d.mts:15:8 - error TS2307: Cannot find module 'node:async_hooks' or its corresponding type declarations.

15 import 'node:async_hooks';
          ~~~~~~~~~~~~~~~~~~


Found 2 errors.

This is a new error as of 7.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions