Skip to content

Commit

Permalink
fix: improve typing compatibility with @types/ioredis (#1542)
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Mar 26, 2022
1 parent 8335e5d commit 3bf300a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/cluster/index.ts
Expand Up @@ -48,6 +48,14 @@ type OfflineQueueItem = {
node: unknown;
};

export type ClusterNode =
| string
| number
| {
host?: string | undefined;
port?: number | undefined;
};

type ClusterStatus =
| "end"
| "close"
Expand Down Expand Up @@ -106,10 +114,7 @@ class Cluster extends Commander {
/**
* Creates an instance of Cluster.
*/
constructor(
startupNodes: (string | number | object)[],
options: ClusterOptions = {}
) {
constructor(startupNodes: ClusterNode[], options: ClusterOptions = {}) {
super();
EventEmitter.call(this);

Expand Down
3 changes: 3 additions & 0 deletions lib/index.ts
Expand Up @@ -52,6 +52,9 @@ export {
} from "./connectors/SentinelConnector";
export { StandaloneConnectionOptions } from "./connectors/StandaloneConnector";
export { RedisOptions, CommonRedisOptions } from "./redis/RedisOptions";
export { ClusterNode } from "./cluster";
export { ClusterOptions } from "./cluster/ClusterOptions";
export { NodeRole } from "./cluster/util";

// No TS typings
export const ReplyError = require("redis-errors").ReplyError;
Expand Down

0 comments on commit 3bf300a

Please sign in to comment.