I have the following code which connects to a MySQL database:
import { Connection, createPool } from 'mysql2'
import { PromisePoolConnection } from 'mysql2/promise'
import Pool from 'mysql2/typings/mysql/lib/Pool'
const poolOptions: Pool.PoolOptions = {
host: 'localhost',
user: 'root',
database: 'node-complete',
password: 'password'
}
const pool: PromisePoolConnection = createPool(poolOptions).promise()
export default pool
I am unsure what the correct type for pool is. Is it PromisePoolConnection or something else? I'm really confused.
Any help would be appreciated.