-
-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
PoolConnection type error after update v3.3.4 #2059
Comments
Hi @matvejs16, I'm gradually looking for typings. The If your code works in JS (ignoring the type errors), can you share a basic repro example? |
Yep, JS is working ok
|
@matvejs16, thanks. I'll test your example and look into it carefully. |
So, I took a look at your example. At first moment, I just commented the So, both the For example:
interface DB {
Handle: mysql.Pool | null;
Handle_Promise: mysqlPromise.Pool | null; // Now, it's a Pool from Promise 🙋🏻♂️
Connect(callback: Function): void;
escape(string: string | number | object | Array<any>): string | number | null;
// getPromiseConnection(): mysqlPromise.PoolConnection | undefined;
}
DB.Connect(async function () {
const pool = DB.Handle_Promise;
/**
* Checking if pool isn't `null` will allow to use the pool methods.
* Note that now, the `Handle_Promise` is a Pool and not a PoolConnection as previously
*/
if (pool === null) return;
const connection = await pool.getConnection();
await connection.beginTransaction();
// RUN MySQL Query
await connection.commit();
connection.release();
}); |
In fact, the |
|
In this error code
Is returning type: mysqlPromise.PoolConnection |
@matvejs16, you right! I got this error after perform a The Thanks for report 🙋🏻♂️ |
@matvejs16, can you check this in |
Sure, but not now, after I wake up 😉 |
After updating I got strange error.
|
Sorry, my fault! |
Getting error: TS2551: Property 'getConnection' does not exist on type 'PoolConnection'. Did you mean 'connection'?
The text was updated successfully, but these errors were encountered: