From 912d1c31d8fc00550d5f9a4d437b874be811a08d Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Mon, 20 Sep 2021 23:34:54 +0200 Subject: :art: rewrite imports --- gateway/src/util/Send.ts | 6 ++---- gateway/src/util/WebSocket.ts | 4 +--- gateway/src/util/setHeartbeat.ts | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'gateway/src/util') diff --git a/gateway/src/util/Send.ts b/gateway/src/util/Send.ts index 1b00e361..ff8aefc9 100644 --- a/gateway/src/util/Send.ts +++ b/gateway/src/util/Send.ts @@ -2,9 +2,7 @@ var erlpack: any; try { erlpack = require("erlpack"); } catch (error) {} -import { Payload } from "@fosscord/gateway/util/Constants"; - -import WebSocket from "./WebSocket"; +import { Payload, WebSocket } from "@fosscord/gateway"; export async function Send(socket: WebSocket, data: Payload) { let buffer: Buffer | string; @@ -20,7 +18,7 @@ export async function Send(socket: WebSocket, data: Payload) { } return new Promise((res, rej) => { - socket.send(buffer, (err) => { + socket.send(buffer, (err: any) => { if (err) return rej(err); return res(null); }); diff --git a/gateway/src/util/WebSocket.ts b/gateway/src/util/WebSocket.ts index 15d1549f..b80265a7 100644 --- a/gateway/src/util/WebSocket.ts +++ b/gateway/src/util/WebSocket.ts @@ -3,7 +3,7 @@ import WS from "ws"; import { Deflate } from "zlib"; import { Channel } from "amqplib"; -interface WebSocket extends WS { +export interface WebSocket extends WS { version: number; user_id: string; session_id: string; @@ -19,5 +19,3 @@ interface WebSocket extends WS { permissions: Record; events: Record; } - -export default WebSocket; diff --git a/gateway/src/util/setHeartbeat.ts b/gateway/src/util/setHeartbeat.ts index 9f88b481..f6871cfe 100644 --- a/gateway/src/util/setHeartbeat.ts +++ b/gateway/src/util/setHeartbeat.ts @@ -1,5 +1,5 @@ import { CLOSECODES } from "./Constants"; -import WebSocket from "./WebSocket"; +import { WebSocket } from "./WebSocket"; // TODO: make heartbeat timeout configurable export function setHeartbeat(socket: WebSocket) { -- cgit 1.5.1