Fix strict TypeScript checks for client

This commit is contained in:
nav
2026-04-09 04:38:03 +00:00
parent 7cdda2e335
commit 57b53fc122
4 changed files with 48 additions and 16 deletions

24
plugin/types/ws.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
declare module "ws" {
export type RawData = Buffer | ArrayBuffer | Buffer[] | string;
export class WebSocket {
static readonly OPEN: number;
constructor(url: string);
readonly readyState: number;
send(data: string): void;
close(code?: number, reason?: string): void;
terminate(): void;
on(event: "open", listener: () => void): this;
on(event: "message", listener: (data: RawData) => void): this;
on(event: "close", listener: (code: number, reason: Buffer) => void): this;
on(event: "error", listener: (error: Error) => void): this;
once(event: "open", listener: () => void): this;
once(event: "error", listener: (error: Error) => void): this;
off(event: "error", listener: (error: Error) => void): this;
removeAllListeners?(event?: string): this;
}
export class WebSocketServer {
constructor(options: { host?: string; port: number });
}
}