Skip to content

Please allow me to export extra values from my routes #87505

@alita-moore

Description

@alita-moore

Link to the code that reproduces this issue

https://stackblitz.com/edit/nextjs-ru8yniyr?file=app%2Flayout.tsx

To Reproduce

  1. run npm install && npx next dev --webpack
  2. notice error

Current vs. Expected behavior

currently it outputs an error:

Type error: Route "app/api/route.ts" does not match the required types of a Next.js Route.
  "SOMETHING" is not a valid Route export field.

but it should not be raising a type error when I add EXTRA parameters.

Provide environment information

❯ next info

Operating System:
  Platform: linux
  Arch: x64
  Version: Ubuntu 20.04.0 LTS Sat Dec 20 2025 23:30:29 GMT+0900 (Japan Standard Time)
  Available memory (MB): NaN
  Available CPU cores: 8
Binaries:
  Node: 20.19.1
  npm: 10.8.2
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.0 // Latest available version is detected (16.1.0).
  eslint-config-next: 13.5.1
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

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

Route Handlers

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

next build (local)

Additional context

I have a use-case where I want to export an extra argument from the route parameter for typing purposes. Please let me do this without raising an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions