Skip to content

Commit c52a888

Browse files
committed
Fix(api): Correct GET handler parameter type with Promise
1 parent 94f0d9c commit c52a888

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

app/api/schemas/[name]/route.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import fs from "fs/promises";
33
import path from "path";
44
import jsonc from "jsonc";
55

6-
// Define the context type explicitly
7-
interface RouteContext {
8-
params: {
9-
name: string;
10-
};
11-
}
6+
// Remove the explicit RouteContext interface
7+
// interface RouteContext {
8+
// params: {
9+
// name: string;
10+
// };
11+
// }
1212

1313
export async function GET(
1414
_request: Request, // Prefix with _ if not used
15-
// Use the explicitly defined RouteContext type
16-
context: RouteContext,
15+
// Use the correct Next.js 15 type signature with Promise
16+
{ params }: { params: Promise<{ name: string }> },
1717
) {
18-
// Destructure params from the context object
19-
const { params } = context;
18+
// Remove the explicit destructuring added in the previous step
19+
// const { params } = context;
2020
console.log("[API /api/schemas/[name]] Waiting for params...");
2121

22-
// Remove await: params is not a promise here
23-
const awaitedParams = params;
22+
// Ensure params is awaited (was likely correct before, but confirming)
23+
const awaitedParams = await params;
2424
console.log(
2525
"[API /api/schemas/[name]] Incoming params resolved:",
2626
awaitedParams,

0 commit comments

Comments
 (0)