Skip to content

7.6.1 breaks typegen for params when using fs-routes #13695

@GardSteinsvik

Description

@GardSteinsvik

I'm using React Router as a...

framework

Reproduction

  1. Go to https://stackblitz.com/edit/github-ovu8zgq7?file=app%2Froutes%2Fparams.%24test.tsx
  2. Wait for npm install && npm run dev
  3. Observe that 'params.test' is possibly 'undefined' on line 4

System Info

System:
    OS: macOS 15.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 86.69 MB / 32.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
    pnpm: 10.6.5 - ~/Library/pnpm/pnpm
    bun: 1.2.13 - ~/.bun/bin/bun
  Browsers:
    Chrome: 136.0.7103.114
    Safari: 18.4
  npmPackages:
    @react-router/dev: 7.6.1 => 7.6.1 
    @react-router/express: 7.6.1 => 7.6.1 
    @react-router/fs-routes: 7.6.1 => 7.6.1 
    @react-router/node: 7.6.1 => 7.6.1 
    @react-router/serve: 7.6.1 => 7.6.1 
    react-router: 7.6.1 => 7.6.1 
    vite: 6.3.5 => 6.3.5

Used Package Manager

npm

Expected Behavior

Route.LoaderArgs should identify that $test is a required param so that test is a key in params and that params.test is a string.
This worked fine in version 7.6.0.

Image

Actual Behavior

Route.LoaderArgs does not identify $test as a param, and test is not an identified key in params by TypeScript. params.test is inferred as string | undefined.

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions