Open rinsuki opened 2 months ago
4.5.1
Node.js
import { Hono } from "hono" import { UpgradeWebSocket } from "hono/ws" declare var upgradeWebSocket: UpgradeWebSocket // actually I'm using `@hono/node-ws` one, but `@hono/node-ws` exposing UpgradeWebSocket as-is const app = new Hono() app.get("/api/rooms/:roomId/info", async c => { const roomId: string = c.req.param("roomId") // @ts-expect-error const yetAnotherParam: string = c.req.param("yetAnotherParam") return c.json({"name": "stub"}) }) app.get("/api/rooms/:roomId/ws", upgradeWebSocket(c => { const roomId: string = c.req.param("roomId") // @ts-expect-error const yetAnotherParam: string = c.req.param("yetAnotherParam") return {} }))
In the example code, c.req.param("yetAnotherParam") should return string | undefined in both handlers (all of // @ts-expect-error should be consumed).
c.req.param("yetAnotherParam")
string | undefined
// @ts-expect-error
In the example code, c.req.param("yetAnotherParam") returns a string in the handler using UpgradeWebSocket.
string
UpgradeWebSocket
No response
Hi @rinsuki
Thank you for the issue. This is related to #3202; if #3202 is resolved, this issue can be fixed.
What version of Hono are you using?
4.5.1
What runtime/platform is your app running on?
Node.js
What steps can reproduce the bug?
What is the expected behavior?
In the example code,
c.req.param("yetAnotherParam")
should returnstring | undefined
in both handlers (all of// @ts-expect-error
should be consumed).What do you see instead?
In the example code,
c.req.param("yetAnotherParam")
returns astring
in the handler usingUpgradeWebSocket
.Additional information
No response