fix(node-ws): allow `Hono` with custom Env for `createNodeWebSocket` (#951)
* fix(node-ws): allow `Hono` with custom Env * add changesetpull/953/head
parent
5cad2e1afe
commit
c80ffbfb4c
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/node-ws': patch
|
||||
---
|
||||
|
||||
fix: allow `Hono` with custom Env for `createNodeWebSocket`
|
|
@ -9,7 +9,7 @@
|
|||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "vitest --run",
|
||||
"test": "tsc --noEmit && vitest --run",
|
||||
"build": "tsup ./src/index.ts --format esm,cjs --dts",
|
||||
"publint": "publint",
|
||||
"release": "yarn build && yarn test && yarn publint && yarn publish"
|
||||
|
@ -48,4 +48,4 @@
|
|||
"engines": {
|
||||
"node": ">=18.14.1"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -149,4 +149,15 @@ describe('WebSocket helper', () => {
|
|||
expect((receivedMessage as Buffer).at(idx)).toBe(val)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Types', () => {
|
||||
it('Should not throw a type error with an app with Variables generics', () => {
|
||||
const app = new Hono<{
|
||||
Variables: {
|
||||
foo: string
|
||||
}
|
||||
}>()
|
||||
createNodeWebSocket({ app })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -12,7 +12,8 @@ export interface NodeWebSocket {
|
|||
injectWebSocket(server: Server | Http2Server | Http2SecureServer): void
|
||||
}
|
||||
export interface NodeWebSocketInit {
|
||||
app: Hono
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
app: Hono<any, any, any>
|
||||
baseUrl?: string | URL
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue