File tree Expand file tree Collapse file tree 4 files changed +6
-16
lines changed
Expand file tree Collapse file tree 4 files changed +6
-16
lines changed Original file line number Diff line number Diff line change 1- import type { UpgradedWebSocketResponseInputJSONType } from '../helper/websocket/index.ts'
21import type { Hono } from '../hono.ts'
32import type { Endpoint , ResponseFormat , Schema } from '../types.ts'
43import type { StatusCode , SuccessStatusCode } from '../utils/http-status.ts'
@@ -34,10 +33,10 @@ export type ClientRequest<S extends Schema> = {
3433 : { }
3534 : { }
3635 ) => URL
37- } & ( S [ '$get' ] extends { input : { json : UpgradedWebSocketResponseInputJSONType } }
36+ } & ( S [ '$get' ] extends { outputFormat : 'ws' }
3837 ? S [ '$get' ] extends { input : infer I }
3938 ? {
40- $ws : ( args ?: Omit < I , 'json' > ) => WebSocket
39+ $ws : ( args ?: I ) => WebSocket
4140 }
4241 : { }
4342 : { } )
Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ export interface WSEvents {
1212 onError ?: ( evt : Event , ws : WSContext ) => void
1313}
1414
15- export type UpgradedWebSocketResponseInputJSONType = '__websocket'
16-
1715/**
1816 * Upgrade WebSocket Type
1917 */
@@ -23,9 +21,7 @@ export type UpgradeWebSocket = (
2321 any ,
2422 string ,
2523 {
26- in : {
27- json : UpgradedWebSocketResponseInputJSONType
28- }
24+ outputFormat : 'ws'
2925 }
3026>
3127
Original file line number Diff line number Diff line change 1- import type { UpgradedWebSocketResponseInputJSONType } from '../helper/websocket'
21import type { Hono } from '../hono'
32import type { Endpoint , ResponseFormat , Schema } from '../types'
43import type { StatusCode , SuccessStatusCode } from '../utils/http-status'
@@ -34,10 +33,10 @@ export type ClientRequest<S extends Schema> = {
3433 : { }
3534 : { }
3635 ) => URL
37- } & ( S [ '$get' ] extends { input : { json : UpgradedWebSocketResponseInputJSONType } }
36+ } & ( S [ '$get' ] extends { outputFormat : 'ws' }
3837 ? S [ '$get' ] extends { input : infer I }
3938 ? {
40- $ws : ( args ?: Omit < I , 'json' > ) => WebSocket
39+ $ws : ( args ?: I ) => WebSocket
4140 }
4241 : { }
4342 : { } )
Original file line number Diff line number Diff line change @@ -12,8 +12,6 @@ export interface WSEvents {
1212 onError ?: ( evt : Event , ws : WSContext ) => void
1313}
1414
15- export type UpgradedWebSocketResponseInputJSONType = '__websocket'
16-
1715/**
1816 * Upgrade WebSocket Type
1917 */
@@ -23,9 +21,7 @@ export type UpgradeWebSocket = (
2321 any ,
2422 string ,
2523 {
26- in : {
27- json : UpgradedWebSocketResponseInputJSONType
28- }
24+ outputFormat : 'ws'
2925 }
3026>
3127
You can’t perform that action at this time.
0 commit comments