Fix strict TypeScript checks for client
This commit is contained in:
24
plugin/types/ws.d.ts
vendored
Normal file
24
plugin/types/ws.d.ts
vendored
Normal 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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user