Skip to content

Commit 24669ea

Browse files
committed
fix(ts): don't use next/dist import
1 parent 7a1a30c commit 24669ea

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

packages/next-auth/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import type {
7979
NextApiRequest,
8080
NextApiResponse,
8181
} from "next"
82-
import type { AppRouteHandlerFn } from "next/dist/server/future/route-modules/app-route/module.js"
82+
import type { AppRouteHandlerFn } from "./lib/types.js"
8383
import type { NextRequest } from "next/server"
8484
import type { NextAuthConfig, NextAuthRequest } from "./lib/index.js"
8585
export { AuthError } from "@auth/core/errors"

packages/next-auth/src/lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
NextApiRequest,
1111
NextApiResponse,
1212
} from "next"
13-
import type { AppRouteHandlerFn } from "next/dist/server/future/route-modules/app-route/module"
13+
import type { AppRouteHandlerFn } from "./types.js"
1414
import type { NextFetchEvent, NextMiddleware, NextRequest } from "next/server"
1515

1616
/** Configure NextAuth.js. */
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { NextRequest } from "next/server"
2+
3+
/**
4+
* AppRouteHandlerFnContext is the context that is passed to the handler as the
5+
* second argument.
6+
*/
7+
type AppRouteHandlerFnContext = {
8+
params?: Record<string, string | string[]>
9+
}
10+
/**
11+
* Handler function for app routes. If a non-Response value is returned, an error
12+
* will be thrown.
13+
*/
14+
export type AppRouteHandlerFn = (
15+
/**
16+
* Incoming request object.
17+
*/
18+
req: NextRequest,
19+
/**
20+
* Context properties on the request (including the parameters if this was a
21+
* dynamic route).
22+
*/
23+
ctx: AppRouteHandlerFnContext
24+
) => unknown
25+
26+
export type AppRouteHandlers = Record<
27+
"GET" | "POST",
28+
(req: NextRequest) => Promise<Response>
29+
>

0 commit comments

Comments
 (0)