diff --git a/.changeset/grumpy-readers-draw.md b/.changeset/grumpy-readers-draw.md new file mode 100644 index 000000000000..32156bc8b81e --- /dev/null +++ b/.changeset/grumpy-readers-draw.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Add `Props` generic for `APIRoute` type diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index c544fd8b8c84..7d7a045792f1 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1765,21 +1765,21 @@ export interface APIContext = Record; - export interface EndpointOutput { body: Body; encoding?: BufferEncoding; } -export type APIRoute = ( - context: APIContext +export type APIRoute = Record> = ( + context: APIContext ) => EndpointOutput | Response | Promise; export interface EndpointHandler { [method: string]: APIRoute | ((params: Params, request: Request) => EndpointOutput | Response); } +export type Props = Record; + export interface AstroRenderer { /** Name of the renderer. */ name: string;