-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts): expose
MiddlewareConfig
interface (#61576)
### What? Expose the `MiddlewareConfig` interface. ### Why? You can now `import type { MiddlewareConfig } from "next/server"` to type the `config` object in your `middleware.ts` file. Now you an type the entire file for example like so: ```ts // middleware.ts import type { NextMiddleware, MiddlewareConfig } from "next/server" export const middleware: NextMiddleware = async (req) => { //... } export const config: MiddlewareConfig = { //... } ``` ### How? Re-exported the interface from its current location via `server/web/types`, to colocate it with `NextMidldeware`. I wonder if we could somehow type this file automatically, but it might be dependent on microsoft/TypeScript#38511 Closes NEXT-2308 [Slack thread](https://vercel.slack.com/archives/C03S9JCH2Q5/p1706287433026409?thread_ts=1706058855.423019&cid=C03S9JCH2Q5), [Slack thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1706659724141899)
- Loading branch information
1 parent
d1fa287
commit 492b415
Showing
4 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters