Skip to content

Pass all route types to hc #1648

Answered by dillondotzip
dillondotzip asked this question in Q&A
Discussion options

You must be logged in to vote

Ok just figured out the issue. Maybe this will help someone else if they come across it @yusukebe.

Before I was doing:

const app = new Hono().basePath('/api')
const post = new Hono()
post.get('/', (c) => c.jsonT(0))
const posts = app.route('/posts', post)

type AppType = typeof posts

What fixed it, was chaining and exporting post like how you have it:

const app = new Hono().basePath('/api')
const post = new Hono().get('/', (c) => c.jsonT(0))
const posts = app.route('/posts', post)

type AppType = typeof posts

Not sure if this is intentional or not.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@dillondotzip
Comment options

@yusukebe
Comment options

@dillondotzip
Comment options

@dillondotzip
Comment options

Answer selected by dillondotzip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants