Missing Pool Promise
Opened this issue · 1 comments
aollag09 commented
Hi there,
The function promise() is not available on the Pool class :( !?
Thanks for your help !
OssiPesonen commented
Tad late to the party here, but here's how I solved my types.
import * as mysql from 'mysql2';
import { Connection, Pool } from 'mysql2';
export const createConnectionPool = (): Pool => {
return mysql.createPool(databaseConfig);
}
// When called I cast it as Connection because Pool extends it
const pool = config.createConnectionPool() as Connection;
const db = pool.promise();
Now the Connection
type for db
is from mysql2/promise