Skip to content

Commit 94f0d9c

Browse files
committed
Fix(api): Refactor GET handler parameter typing
1 parent ac545ce commit 94f0d9c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

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

6-
// Define the expected structure of the context parameter
7-
// Remove the custom GetContext interface
8-
// interface GetContext {
9-
// params: {
10-
// name: string;
11-
// };
12-
// }
6+
// Define the context type explicitly
7+
interface RouteContext {
8+
params: {
9+
name: string;
10+
};
11+
}
1312

1413
export async function GET(
1514
_request: Request, // Prefix with _ if not used
16-
// Use the standard Next.js context typing for route parameters
17-
{ params }: { params: { name: string } },
15+
// Use the explicitly defined RouteContext type
16+
context: RouteContext,
1817
) {
18+
// Destructure params from the context object
19+
const { params } = context;
1920
console.log("[API /api/schemas/[name]] Waiting for params...");
2021

2122
// Remove await: params is not a promise here

0 commit comments

Comments
 (0)