Skip to content

Commit ff3c36c

Browse files
authored
fix: createPool promise as PromisePool (#2060)
1 parent 1a9972d commit ff3c36c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { mysql, mysqlp } from '../../../index';
2+
import { access } from '../../baseConnection';
3+
4+
(async () => {
5+
let pool: mysql.Pool | null = null;
6+
let promisePool: mysqlp.Pool | null = null;
7+
let conn: mysqlp.PoolConnection | null = null;
8+
9+
if (pool === null) return;
10+
11+
pool = mysql.createPool(access);
12+
promisePool = pool.promise();
13+
conn = await promisePool.getConnection();
14+
15+
conn.release();
16+
})();

typings/mysql/lib/Pool.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {OkPacket, RowDataPacket, FieldPacket, ResultSetHeader} from './protocol/
44
import Connection = require('./Connection');
55
import PoolConnection = require('./PoolConnection');
66
import {EventEmitter} from 'events';
7-
import {PoolConnection as PromisePoolConnection} from '../../../promise';
7+
import {Pool as PromisePool} from '../../../promise';
88

99
declare namespace Pool {
1010

@@ -78,7 +78,7 @@ declare class Pool extends EventEmitter {
7878
on(event: string, listener: Function): this;
7979
on(event: 'connection', listener: (connection: PoolConnection) => any): this;
8080

81-
promise(promiseImpl?: PromiseConstructor): PromisePoolConnection;
81+
promise(promiseImpl?: PromiseConstructor): PromisePool;
8282
}
8383

8484
export = Pool;

0 commit comments

Comments
 (0)