Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ws types #7605

Merged
merged 1 commit into from Apr 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/vite/src/node/server/ws.ts
Expand Up @@ -5,6 +5,7 @@ import type { ServerOptions as HttpsServerOptions } from 'https'
import { createServer as createHttpsServer } from 'https'
import type { ServerOptions, WebSocket as WebSocketRaw } from 'ws'
import { WebSocketServer as WebSocketServerRaw } from 'ws'
import type { WebSocket as WebSocketTypes } from 'types/ws'
import type { CustomPayload, ErrorPayload, HMRPayload } from 'types/hmrPayload'
import type { InferCustomEventPayload } from 'types/customEvent'
import type { ResolvedConfig } from '..'
Expand Down Expand Up @@ -38,7 +39,7 @@ export interface WebSocketServer {
/**
* Handle custom event emitted by `import.meta.hot.send`
*/
on: WebSocketServerRaw['on'] & {
on: WebSocketTypes.Server['on'] & {
<T extends string>(
event: T,
listener: WebSocketCustomListener<InferCustomEventPayload<T>>
Expand All @@ -47,7 +48,7 @@ export interface WebSocketServer {
/**
* Unregister event listener.
*/
off: WebSocketServerRaw['off'] & {
off: WebSocketTypes.Server['off'] & {
(event: string, listener: Function): void
}
}
Expand All @@ -65,7 +66,7 @@ export interface WebSocketClient {
* The raw WebSocket instance
* @advanced
*/
socket: WebSocketRaw
socket: WebSocketTypes
}

const wsServerEvents = [
Expand Down