Skip to content

Commit 8853000

Browse files
terrierscript0ubbe
andauthored
fix(ts): handleMiddleware return type can be NextMiddlewareResult (#4818)
Co-authored-by: Lluis Agusti <hi@llu.lu>
1 parent 70ffa65 commit 8853000

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/next-auth/src/next/middleware.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ export interface NextAuthMiddlewareOptions {
9292
secret?: string
9393
}
9494

95+
type NextMiddlewareResult = ReturnType<NextMiddleware>
96+
9597
async function handleMiddleware(
9698
req: NextRequest,
9799
options: NextAuthMiddlewareOptions | undefined,
98-
onSuccess?: (token: JWT | null) => Promise<any>
100+
onSuccess?: (token: JWT | null) => Promise<NextMiddlewareResult>
99101
) {
100102
const signInPage = options?.pages?.signIn ?? "/api/auth/signin"
101103
const errorPage = options?.pages?.error ?? "/api/auth/error"

0 commit comments

Comments
 (0)