hono icon indicating copy to clipboard operation
hono copied to clipboard

`outputFormat` supports Response

Open nakasyou opened this issue 1 year ago • 1 comments

What is the feature you are proposing?

I want outputFormat to support Response.

Currently, outputFormat supports only Handler:

import { Hono } from 'hono'
import { customHandler } from './xxx' // CustomHandler has `outputFormat` type in Input

const app = new Hono()
app.get('/', customHandler)

I want make helper, it makes response.

import { Hono } from 'hono'
import { customHelper } from './xxx'

const app = new Hono()
app.get('/', () => {
  return customHelper() // I want Response to have `outputFormat`
})

Because I want to make helper and client for helper.

nakasyou avatar Jun 23 '24 08:06 nakasyou

Hi @nakasyou, do you have a PoC of the helper you're creating?, If the customHelper() returns a Response I think currently we could do:

const customHelper = (): Response & TypedResponse => {}

And it would fully support our current type interface.

NamesMT avatar Jun 23 '24 15:06 NamesMT