vercel / vercel/next.js

TypedRoutes doesn't work with trailingSlash config

Open
#83,185 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Linking and Navigating TypeScript
Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 13h
Merged PRs (30d)
334

Description

Link to the code that reproduces this issue

https://github.com/damianfrizzi/next-typed-routes-bug

To Reproduce
  1. Clone repo
  2. Run bun run tsc
Current vs. Expected behavior

The typedRoutes config seems to not respect trailingSlash config. If trailingSlash: true I'd expect the generated routes to contain a trailing slash but they don't.

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 22.15.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.5.2 // Latest available version is detected (15.5.2).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Linking and Navigating, TypeScript

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local)

Additional context

I tested my reproduction against v15.5.1-canary.16 and 15.5.2.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by cloning the linked reproduction repository and running bun run tsc with trailingSlash: true. No project file or test is named in the issue, so trace the typedRoutes route generation from the TypeScript error or generated output. Done means generated routes include trailing slashes and the reproduction type-checks successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.