Skip to content

Commit 3bf300a

Browse files
authoredMar 26, 2022
fix: improve typing compatibility with @types/ioredis (#1542)
1 parent 8335e5d commit 3bf300a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
 

‎lib/cluster/index.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ type OfflineQueueItem = {
4848
node: unknown;
4949
};
5050

51+
export type ClusterNode =
52+
| string
53+
| number
54+
| {
55+
host?: string | undefined;
56+
port?: number | undefined;
57+
};
58+
5159
type ClusterStatus =
5260
| "end"
5361
| "close"
@@ -106,10 +114,7 @@ class Cluster extends Commander {
106114
/**
107115
* Creates an instance of Cluster.
108116
*/
109-
constructor(
110-
startupNodes: (string | number | object)[],
111-
options: ClusterOptions = {}
112-
) {
117+
constructor(startupNodes: ClusterNode[], options: ClusterOptions = {}) {
113118
super();
114119
EventEmitter.call(this);
115120

‎lib/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export {
5252
} from "./connectors/SentinelConnector";
5353
export { StandaloneConnectionOptions } from "./connectors/StandaloneConnector";
5454
export { RedisOptions, CommonRedisOptions } from "./redis/RedisOptions";
55+
export { ClusterNode } from "./cluster";
56+
export { ClusterOptions } from "./cluster/ClusterOptions";
57+
export { NodeRole } from "./cluster/util";
5558

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

0 commit comments

Comments
 (0)
Please sign in to comment.