Skip to content

Commit 3902ca6

Browse files
committed
fix: PoolCluster typings
1 parent b2c5b49 commit 3902ca6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

typings/mysql/lib/PoolCluster.d.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { EventEmitter } from 'events';
22
import { PoolConnection } from './PoolConnection.js';
33
import { PoolOptions } from './Pool.js';
4+
import { ExecutableBase as ExecutableBaseClass } from './protocol/sequences/ExecutableBase.js';
5+
import { QueryableBase as QueryableBaseClass } from './protocol/sequences/QueryableBase.js';
6+
7+
// Expose class interfaces
8+
declare class QueryableAndExecutableBase extends QueryableBaseClass(
9+
ExecutableBaseClass(EventEmitter)
10+
) {}
411

512
export interface PoolClusterOptions {
613
/**
@@ -29,10 +36,20 @@ export interface PoolClusterOptions {
2936
defaultSelector?: string;
3037
}
3138

39+
export interface PoolNamespace extends QueryableAndExecutableBase {
40+
getConnection(
41+
callback: (
42+
err: NodeJS.ErrnoException | null,
43+
connection: PoolConnection
44+
) => any
45+
): void;
46+
}
47+
3248
declare class PoolCluster extends EventEmitter {
3349
config: PoolClusterOptions;
3450

3551
add(config: PoolOptions): void;
52+
add(group: string, connectionUri: string): void;
3653
add(group: string, config: PoolOptions): void;
3754

3855
end(): void;
@@ -59,7 +76,7 @@ declare class PoolCluster extends EventEmitter {
5976
) => void
6077
): void;
6178

62-
of(pattern: string, selector?: string): PoolCluster;
79+
of(pattern: string, selector?: string): PoolNamespace;
6380

6481
on(event: string, listener: (args: any[]) => void): this;
6582
on(event: 'remove', listener: (nodeId: number) => void): this;

0 commit comments

Comments
 (0)