Skip to content

Commit

Permalink
Merge branch 'main' into sarah11918-patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored Jan 5, 2024
2 parents 3417a64 + d87a97e commit 7b772cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-bottles-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Adds a second generic parameter to `APIRoute` to type the `params`
7 changes: 4 additions & 3 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2262,9 +2262,10 @@ type Routing = {
strategy: 'pathname';
};

export type APIRoute<Props extends Record<string, any> = Record<string, any>> = (
context: APIContext<Props>
) => Response | Promise<Response>;
export type APIRoute<
Props extends Record<string, any> = Record<string, any>,
APIParams extends Record<string, string | undefined> = Record<string, string | undefined>,
> = (context: APIContext<Props, APIParams>) => Response | Promise<Response>;

export interface EndpointHandler {
[method: string]: APIRoute;
Expand Down

0 comments on commit 7b772cd

Please sign in to comment.