Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve typing compatibility with @types/ioredis #1542

Merged
merged 1 commit into from Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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