Skip to content

Commit a077603

Browse files
k-taro56ThangHuuVu
andauthored
fix(next-auth): add missing middleware wrapper type to auth function (#13026)
Co-authored-by: Thang Vu <[email protected]>
1 parent e0168ed commit a077603

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/next-auth/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ import type {
8484
AppRouteHandlerFnContext,
8585
} from "./lib/types.js"
8686
// @ts-expect-error Next.js does not yet correctly use the `package.json#exports` field
87-
import type { NextRequest } from "next/server"
88-
import type { NextAuthConfig, NextAuthRequest } from "./lib/index.js"
87+
import type { NextRequest, NextMiddleware } from "next/server"
88+
import type {
89+
NextAuthConfig,
90+
NextAuthRequest,
91+
NextAuthMiddleware,
92+
} from "./lib/index.js"
8993
export { AuthError, CredentialsSignin } from "@auth/core/errors"
9094

9195
export { customFetch }
@@ -245,7 +249,8 @@ export interface NextAuthResult {
245249
ctx: AppRouteHandlerFnContext
246250
) => ReturnType<AppRouteHandlerFn>,
247251
]
248-
) => AppRouteHandlerFn)
252+
) => AppRouteHandlerFn) &
253+
((...args: [NextAuthMiddleware]) => NextMiddleware)
249254
/**
250255
* Sign in with a provider. If no provider is specified, the user will be redirected to the sign in page.
251256
*

0 commit comments

Comments
 (0)