Skip to content

Commit

Permalink
fix: createPool promise as PromisePool (#2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Jun 12, 2023
1 parent 1a9972d commit ff3c36c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions test/tsc-build/mysql/createPool/promise/promise.ts
@@ -0,0 +1,16 @@
import { mysql, mysqlp } from '../../../index';
import { access } from '../../baseConnection';

(async () => {
let pool: mysql.Pool | null = null;
let promisePool: mysqlp.Pool | null = null;
let conn: mysqlp.PoolConnection | null = null;

if (pool === null) return;

pool = mysql.createPool(access);
promisePool = pool.promise();
conn = await promisePool.getConnection();

conn.release();
})();
4 changes: 2 additions & 2 deletions typings/mysql/lib/Pool.d.ts
Expand Up @@ -4,7 +4,7 @@ import {OkPacket, RowDataPacket, FieldPacket, ResultSetHeader} from './protocol/
import Connection = require('./Connection');
import PoolConnection = require('./PoolConnection');
import {EventEmitter} from 'events';
import {PoolConnection as PromisePoolConnection} from '../../../promise';
import {Pool as PromisePool} from '../../../promise';

declare namespace Pool {

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

promise(promiseImpl?: PromiseConstructor): PromisePoolConnection;
promise(promiseImpl?: PromiseConstructor): PromisePool;
}

export = Pool;

0 comments on commit ff3c36c

Please sign in to comment.