-
-
Notifications
You must be signed in to change notification settings - Fork 641
Description
📝 Description:
Using TypeScript with mysql2/promise
, I expected the Pool
object to expose a config
property directly, but it's deeply nested under pool.connectionConfig
, and the type definitions do not reflect this structure.
📄 Issue Body:
🧩 Context
I'm using mysql2/promise
in a TypeScript project. While working with a Pool
instance (created via mysql.createPool(...)
), I noticed that accessing pool.config
returns undefined
.
I expected to access the connection options like host
, user
, password
, etc., via pool.config
, based on the PoolConnection
type.
However, after inspecting the structure of the pool object, I found that:
pool.config // undefined
pool.pool.config // still undefined
pool.pool.config.connectionConfig // contains the expected values
Only pool.pool.config.connectionConfig
contains the values I originally passed into createPool()
.
📦 Problem
- The actual structure is quite nested (
pool.pool.config.connectionConfig
). - The
Pool
type frommysql2/promise
does not expose or document this structure. - This creates confusion and TypeScript type mismatches when accessing configuration properties.
📸 Images






✅ Suggested Fix
Either:
- Expose the configuration object more clearly (e.g., make
pool.config
work as expected), or - Update the TypeScript definitions to reflect the internal structure more accurately, so developers can access properties like
host
,user
, etc., through the correct path.
Thanks for maintaining this project!
(i use chatgpt to help me write and translate the problem i want to make you know)