Skip to content

Commit

Permalink
fix(types): use correct return type for c.html depending on input
Browse files Browse the repository at this point in the history
  • Loading branch information
asmadsen committed Jun 14, 2024
1 parent 614dff0 commit 33750b8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,14 @@ type JSONRespondReturn<
* @returns A Response object or a Promise that resolves to a Response object.
*/
interface HTMLRespond {
(html: string | Promise<string>, status?: StatusCode, headers?: HeaderRecord):
| Response
| Promise<Response>
(html: string | Promise<string>, init?: ResponseInit): Response | Promise<Response>
<T extends string | Promise<string>>(
html: T,
status?: StatusCode,
headers?: HeaderRecord
): T extends string ? Response : Promise<Response>
<T extends string | Promise<string>>(html: T, init?: ResponseInit): T extends string
? Response
: Promise<Response>
}

/**
Expand Down

0 comments on commit 33750b8

Please sign in to comment.