Skip to content

Typecheck fails because of virtual:react-router/server-build #13265

Closed
@stevan-borus

Description

@stevan-borus

I'm using React Router as a...

framework

Reproduction

stackblitz

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 85.94 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    pnpm: 10.5.0 - ~/Library/pnpm/pnpm
    Watchman: 2024.08.26.00 - /opt/homebrew/bin/watchman
Browsers:
    Chrome: 134.0.6998.89
    Edge: 134.0.3124.68
    Safari: 18.3.1
npmPackages:
    @react-router/dev: ^7.4.0 => 7.4.0 
    @react-router/node: ^7.4.0 => 7.4.0 
    react-router: ^7.4.0 => 7.4.0 
    vite: ^6.2.2 => 6.2.2

Used Package Manager

pnpm

Expected Behavior

typecheck should not emit errors tied to virtual:react-router/server-build and react-router in +virtual.ts file

it passes when exactOptionalPropertyTypes is enabled like it's mentioned here but then a lot of different errors pop up throughout the codebase because of exactOptionalPropertyTypes

Actual Behavior

typecheck on v7.4.0 produces these two errors:

.react-router/types/+virtual.ts:1:16 - error TS2664: Invalid module name in augmentation, module 'virtual:react-router/server-build' cannot be found.

declare module "virtual:react-router/server-build" {

.react-router/types/+virtual.ts:2:31 - error TS2307: Cannot find module 'react-router' or its corresponding type declarations.

import { ServerBuild } from "react-router";

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions