From 001a88858f572fb5bbe5a328aefb8762539e74fd Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 19 Dec 2024 19:59:21 +1100 Subject: [PATCH] refactor: rewrite `conn` type for `RedisClient` (#187) --- mod.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mod.ts b/mod.ts index 6e23b4c..00505ac 100644 --- a/mod.ts +++ b/mod.ts @@ -228,7 +228,7 @@ export async function readReply( } async function sendCommand( - redisConn: Deno.Conn, + redisConn: Reader & Writer, command: Command, raw = false, ): Promise { @@ -237,7 +237,7 @@ async function sendCommand( } async function pipelineCommands( - redisConn: Deno.Conn, + redisConn: Reader & Writer, commands: Command[], ): Promise { const bytes = commands.map(createRequest); @@ -246,7 +246,7 @@ async function pipelineCommands( } async function* readReplies( - redisConn: Deno.Conn, + redisConn: Reader & Writer, raw = false, ): AsyncIterableIterator { const iterator = readLines(redisConn); @@ -256,11 +256,11 @@ async function* readReplies( } export class RedisClient { - #conn: Deno.TcpConn | Deno.TlsConn; + #conn: Reader & Writer; #queue: Promise = Promise.resolve(); /** Constructs a new instance. */ - constructor(conn: Deno.TcpConn | Deno.TlsConn) { + constructor(conn: Reader & Writer) { this.#conn = conn; }