Repository: next.js
Issue: type MiddlewareConfig is wrong?
Labels: bug,Linting,TypeScript

### Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/musing-nash-kl6w8q?workspaceId=9277ae04-72de-484d-97e4-3bec31a4e83d&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clzav37p700063b6j72el6jjk%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clzav37p600023b6jf4dudj20%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clzav37p600043b6j876ijxve%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clzav37p600053b6j9tv2l5ro%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clzav37p600023b6jf4dudj20%2522%253A%257B%2522id%2522%253A%2522clzav37p600023b6jf4dudj20%2522%252C%2522tabs%2522%253A%255B%255D%257D%252C%2522clzav37p600053b6j9tv2l5ro%2522%253A%257B%2522id%2522%253A%2522clzav37p600053b6j9tv2l5ro%2522%252C%2522activeTabId%2522%253A%2522clzavl18n005s3b6jfmz7wngv%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clzavd2k5002n3b6jzzckgjuk%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clzavgir5003q3b6j5rm2qhgu%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522TESTS%2522%252C%2522id%2522%253A%2522clzavgwu6004o3b6j7d15vixl%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%252C%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A3000%252C%2522id%2522%253A%2522clzavl18n005s3b6jfmz7wngv%2522%252C%2522mode%2522%253A%2522permanent%2522%257D%255D%257D%252C%2522clzav37p600043b6j876ijxve%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clzav37p600033b6jt8eq9pb3%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%255D%252C%2522id%2522%253A%2522clzav37p600043b6j876ijxve%2522%252C%2522activeTabId%2522%253A%2522clzav37p600033b6jt8eq9pb3%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

### To Reproduce

The type `MiddlewareConfig` does not describe what `export const config` is supposed to look like.

### Current vs. Expected behavior

The type `MiddlewareConfig` in `next.js/packages/next/src/build/analysis/get-page-static-info.ts` reads as
```
export interface MiddlewareConfig {
  /**
   * Read more: [Next.js Docs: Middleware `matcher`](https://nextjs.org/docs/app/api-reference/file-conventions/middleware#matcher),
   * [Next.js Docs: Middleware matching paths](https://nextjs.org/docs/app/building-your-application/routing/middleware#matching-paths)
   */
  matcher?: string | string[] | MiddlewareMatcher[]
  unstable_allowDynamicGlobs?: string[]
  regions?: string[] | string
}

export interface MiddlewareMatcher {
  regexp: string
  locale?: false
  has?: RouteHas[]
  missing?: RouteHas[]
  originalSource: string
}
```

but including either `regexp` or `originalSource` in a MiddlewareMatcher Object throws an error (`invalid fields: originalSource,regexp for route`) when you run next dev. In the documentation (that is linked in the JS doc of the type) source is used instead of `originalSource`.

Looking for `originalSource` in this repository does give some results, so it might be that the type is correct for some internal use, but if that is the case the description is wrong and the type for the actual config variable does not exist.

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.17.1
  npm: 10.2.5
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: 14.2.5
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.2.2
Next.js Config:
  output: N/A
```


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

Linting, TypeScript

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

next dev (local)

### Additional context

_No response_