Skip to content

Commit 401fd3e

Browse files
authoredJan 5, 2024
feat: Add APIRoute second generic (#9618)
1 parent 47b951b commit 401fd3e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎.changeset/fair-bottles-lie.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro": patch
3+
---
4+
5+
Adds a second generic parameter to `APIRoute` to type the `params`

‎packages/astro/src/@types/astro.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2262,8 +2262,8 @@ type Routing = {
22622262
strategy: 'pathname';
22632263
};
22642264

2265-
export type APIRoute<Props extends Record<string, any> = Record<string, any>> = (
2266-
context: APIContext<Props>
2265+
export type APIRoute<Props extends Record<string, any> = Record<string, any>, APIParams extends Record<string, string | undefined> = Record<string, string | undefined>> = (
2266+
context: APIContext<Props, APIParams>
22672267
) => Response | Promise<Response>;
22682268

22692269
export interface EndpointHandler {

0 commit comments

Comments
 (0)
Please sign in to comment.