jcs224 / hono_sessions

Cookie-based sessions for Hono applications
https://jsr.io/@jcs224/hono-sessions
MIT License
53 stars 6 forks source link

Support for hono v4 #11

Closed mosheduminer closed 3 months ago

mosheduminer commented 3 months ago

Hi! As I was setting up this library, I noticed that it is using hono v3.12.8, although hono released v4 a few months ago. I was wondering if it is possible to bump the library deps (and whether it matters)?

For context, I'm using hono/hono-sessions with CF workers, using pnpm as the package manager, and I noticed this issue because there is a type mismatch (on app.use(sessionMiddleware(...))) due to the fact that hono-sessions is pulling in an old version hono (types).

jcs224 commented 3 months ago

Hi there,

Thanks for the interest in the library! The middleware API hasn't changed with v4, so you should still be able to use this library with the latest Hono. I'm sure we'll come up with a better system in the future, but for now, you can make the error go away by putting a ts-ignore comment above the app line, like so:

// @ts-ignore
app.use(sessionMiddleware(...))

Hopefully that's the only type failure. I will probably do a v4 upgrade anyway soon. I will update the docs as well.

jcs224 commented 3 months ago

Added guidance in the readme https://github.com/jcs224/hono_sessions?tab=readme-ov-file#typescript-errors