Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
davidesigner opened this issue Mar 16, 2025 · 1 comment

Comments

@davidesigner
Copy link

davidesigner commented Mar 16, 2025

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?": {
     ~~~~~~~~~
@davidesigner davidesigner changed the title [Bug]: Layout routes with corresponding index routes cause clashing duplicate types (when optional params) [Bug]: Layout routes with corresponding index routes cause clashing duplicate types (when remix-flat-routes) Mar 16, 2025
@davidesigner
Copy link
Author

This bug is similar to #13059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants