Open
Description
I'm using version 3.9.7 of mysql2
, running TypeScript 5.4.3
I'm importing this module with import mysql from "mysql2/promise";
When I create a Pool
with mysql.createPool
, I get my pool and am able to use it without any problems.
However, when I come to wrap things up, I call pool.destroy()
. No complaints from TS, but when I run the code, I get:
<REDACTED>/db/stores/SqlStore.js:19
pool.destroy();
^
TypeError: pool.destroy is not a function
at SqlStore.shutdown (<REDACTED>/db/stores/SqlStore.js:19:14)
at <REDACTED>/tools/migrate-to-mongo.mts:85:54
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
I took a look at promises.d.ts
in the code base and I can see why there's no type error:
export interface Pool extends Connection {
Since destroy
is a method in the Connection
interface, it's also a method in the Pool
interface.
I'm not sure if the bug is the assertion that Pool
extends Connection
or whether it's just that Pool
only supports some methods of Connection
.