Closed PatNei closed 4 months ago
app.use('/pages/*', async (c, next) => { c.setRenderer((content, head) => { return c.html( <html lang='en'> <head> <title>{head.title}</title> </head> <body> <header>{head.title}</header> <p>{content}</p> </body> </html> ) }) await next() })
Will throw a compile error if you don't have the ContextRenderer return a Response or Promise, like so
declare module "hono" { interface ContextRenderer { (content: string | Promise<string>, head: { title: string }): Response | Promise<Response>; } }
Hi @PatNei
Exactly, we should add Promise<Response>! Thanks.
Promise<Response>
Will throw a compile error if you don't have the ContextRenderer return a Response or Promise, like so