nextjs - 💡(How to fix) Fix Route type does not include dynamic slugs [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#84363Fetched 2026-04-08 02:19:42
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
commented ×1issue_type_added ×1labeled ×1subscribed ×1

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.1.0: Mon Oct  9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.5.2 // There is a newer version (15.5.4) available, upgrade recommended! 
  eslint-config-next: 15.0.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.8.3
Next.js Config:
  output: N/A
There is a newer version (15.5.4) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/goofy-gianmarco-x94fy6?file=%2Fapp%2Fpage.tsx%3A7%2C30

To Reproduce

Add a dynamic route (slug) such as /time-card/[id]/page.tsx

Notice that navigating to this route works using a Link component:

<Link href='/time-card/123'/>

But it does not work when typing it as route. const route: Route = '/time-card/123'

Type '"/time-card/123"' is not assignable to type 'Route'

Current vs. Expected behavior

Current: Route type fails to type dynamic slugs

Expected: Route type should be able to type dynamic slugs (just like <Link/> component)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.1.0: Mon Oct  9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 15.5.2 // There is a newer version (15.5.4) available, upgrade recommended! 
  eslint-config-next: 15.0.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.8.3
Next.js Config:
  output: N/A
 ⚠ There is a newer version (15.5.4) available, upgrade recommended! 
   Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
   Read more - https://nextjs.org/docs/messages/opening-an-issue

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

Dynamic Routes

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

next dev (local)

Additional context

No response

extent analysis

TL;DR

Upgrade to the latest version of Next.js, as the current version (15.5.2) may have a bug that is causing the issue with dynamic routes.

Guidance

  • Check the Next.js documentation for any known issues or updates related to dynamic routes and typing.
  • Verify that the issue persists after upgrading to the latest version of Next.js (15.5.4) as recommended.
  • Review the type definitions for the Route type to ensure it is compatible with dynamic slugs.
  • Consider trying the latest canary version of Next.js (npm install next@canary) to confirm if the issue still exists.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The issue may be specific to the current version of Next.js (15.5.2) and upgrading to the latest version may resolve the issue. However, without further information or testing, it is uncertain if this will fully resolve the issue.

Recommendation

Upgrade to the latest version of Next.js (15.5.4), as it is likely to include bug fixes and improvements that may address the issue with dynamic routes and typing.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING