Skip to content

Commit

Permalink
fix(lint): add missing return type
Browse files Browse the repository at this point in the history
  • Loading branch information
babiabeo committed Mar 2, 2024
1 parent bcb5966 commit 64f679d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Deko {
}

/** Connects to the WebSocket server and does handshake. */
async connect() {
async connect(): Promise<void> {
if (this.state !== DekoState.CLOSED) {
throw new Deno.errors.ConnectionRefused(
`The client state is: ${DekoState[this.state]}`,
Expand Down Expand Up @@ -158,7 +158,7 @@ export class Deko {
}

/** Sends a message frame to the websocket. */
sendMessage(mes: string | Uint8Array) {
sendMessage(mes: string | Uint8Array): Promise<void> {
if (typeof mes === "string") {
return this.sendFrame(OpCode.TextFrame, encode(mes));
}
Expand All @@ -167,17 +167,17 @@ export class Deko {
}

/** Sends a ping message to the websocket. */
sendPing(data?: Uint8Array) {
sendPing(data?: Uint8Array): Promise<void> {
return this.sendFrame(OpCode.Ping, data);
}

/** Sends a pong message to the websocket. */
sendPong(data?: Uint8Array) {
sendPong(data?: Uint8Array): Promise<void> {
return this.sendFrame(OpCode.Pong, data);
}

/** Sends a frame to the websocket. */
async sendFrame(opcode: OpCode, data?: Uint8Array) {
async sendFrame(opcode: OpCode, data?: Uint8Array): Promise<void> {
if (this.state !== DekoState.OPEN && this.state !== DekoState.CLOSING) {
throw new Deno.errors.NotConnected("Client is not connected");
}
Expand Down Expand Up @@ -228,7 +228,7 @@ export class Deko {
}

/** Closes the WebSocket connection. */
async close(options: CloseOptions = {}) {
async close(options: CloseOptions = {}): Promise<void> {
if (this.state === DekoState.CLOSING || this.state === DekoState.CLOSED) {
return;
}
Expand Down

0 comments on commit 64f679d

Please sign in to comment.