Skip to content

[Bug]: Layout routes with corresponding index routes cause clashing duplicate types (when remix-flat-routes) #13235

Closed
@davidesigner

Description

@davidesigner

I'm using React Router as a...

framework

Reproduction

Go to https://stackblitz.com/edit/rr7-730-typegen-bug?file=package.json and run npm run typecheck in the terminal.

System Info

System:
    OS: macOS 15.3.2
    CPU: (12) arm64 Apple M2 Max
    Memory: 27.72 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.0.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    bun: 1.2.5 - /opt/homebrew/bin/bun
  npmPackages:
    @react-router/dev: ^7.3.0 => 7.3.0 
    @react-router/express: ^7.3.0 => 7.3.0 
    @react-router/node: ^7.3.0 => 7.3.0 
    @react-router/remix-routes-option-adapter: ^7.3.0 => 7.3.0 
    react-router: ^7.3.0 => 7.3.0 
    vite: ^6.2.2 => 6.2.2

Used Package Manager

npm

Expected Behavior

I would expect it to handle routes with remix-flat-routes as 7.1.5 does (reproduction repo here and run npm run typecheck in the terminal: no error).

Actual Behavior

npm run typecheck

> typecheck
> react-router typegen && safe-routes typegen && tsc

.react-router/types/+register.ts:15:3 - error TS2300: Duplicate identifier '/:lang?'.

15   "/:lang?": {
     ~~~~~~~~~

.react-router/types/+register.ts:37:3 - error TS2300: Duplicate identifier '/:lang?'.

37   "/:lang?": {
     ~~~~~~~~~

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions