Skip to content

Commit

Permalink
fix: remove extraneous TCP/IPC properties from RedisOptions TS type (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
schmod authored Jan 25, 2023
1 parent a3159af commit 9af7b1c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/connectors/StandaloneConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { NetStream } from "../types";
import { CONNECTION_CLOSED_ERROR_MSG } from "../utils";
import AbstractConnector, { ErrorEmitter } from "./AbstractConnector";

export type StandaloneConnectionOptions = (Partial<TcpNetConnectOpts> &
Partial<IpcNetConnectOpts>) & {
type TcpOptions = Pick<TcpNetConnectOpts, "port" | "host" | "family">;
type IpcOptions = Pick<IpcNetConnectOpts, "path">;

export type StandaloneConnectionOptions = Partial<TcpOptions & IpcOptions> & {
disconnectTimeout?: number;
tls?: ConnectionOptions;
};
Expand All @@ -19,13 +21,13 @@ export default class StandaloneConnector extends AbstractConnector {
const { options } = this;
this.connecting = true;

let connectionOptions: TcpNetConnectOpts | IpcNetConnectOpts;
let connectionOptions: TcpOptions | IpcOptions;
if ("path" in options && options.path) {
connectionOptions = {
path: options.path,
} as IpcNetConnectOpts;
} as IpcOptions;
} else {
connectionOptions = {} as TcpNetConnectOpts;
connectionOptions = {} as TcpOptions;
if ("port" in options && options.port != null) {
connectionOptions.port = options.port;
}
Expand Down

0 comments on commit 9af7b1c

Please sign in to comment.