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 and luin committed Apr 15, 2023
1 parent 4145122 commit ecc44b6
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 ecc44b6

Please sign in to comment.