Skip to content

Commit 1ded1a8

Browse files
authored
fix: ws types (#6083)
1 parent 745c2ec commit 1ded1a8

File tree

5 files changed

+297
-294
lines changed

5 files changed

+297
-294
lines changed

packages/vite/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@types/resolve": "^1.20.1",
7575
"@types/sass": "~1.43.0",
7676
"@types/stylus": "^0.48.36",
77-
"@types/ws": "^8.2.0",
77+
"@types/ws": "^8.2.2",
7878
"@vue/compiler-dom": "^3.2.22",
7979
"acorn": "^8.6.0",
8080
"acorn-class-fields": "^1.0.0",
@@ -117,7 +117,7 @@
117117
"tsconfck": "1.1.1",
118118
"tslib": "^2.3.1",
119119
"types": "link:./types",
120-
"ws": "^8.2.3"
120+
"ws": "^8.3.0"
121121
},
122122
"peerDependencies": {
123123
"less": "*",

packages/vite/src/node/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export type {
8383
ErrorPayload
8484
} from 'types/hmrPayload'
8585
export type { Connect } from 'types/connect'
86-
export type { WebSocket } from 'types/ws'
86+
export type { WebSocket, WebSocketAlias } from 'types/ws'
8787
export type { HttpProxy } from 'types/http-proxy'
8888
export type { FSWatcher, WatchOptions } from 'types/chokidar'
8989
export type { Terser } from 'types/terser'

packages/vite/src/node/server/ws.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import {
55
ServerOptions as HttpsServerOptions
66
} from 'https'
77
import { WebSocketServer as WebSocket, ServerOptions } from 'ws'
8+
import { WebSocket as WebSocketTypes } from 'types/ws'
89
import { ErrorPayload, HMRPayload } from 'types/hmrPayload'
910
import { ResolvedConfig } from '..'
1011
import { isObject } from '../utils'
1112
import { Socket } from 'net'
1213
export const HMR_HEADER = 'vite-hmr'
1314

1415
export interface WebSocketServer {
15-
on: WebSocket['on']
16-
off: WebSocket['off']
16+
on: WebSocketTypes.Server['on']
17+
off: WebSocketTypes.Server['off']
1718
send(payload: HMRPayload): void
1819
close(): Promise<void>
1920
}

0 commit comments

Comments
 (0)