node-mysql2: Typing error in v3.0.0-rc1 Interface 'PoolConnection' cannot simultaneously extend types 'PoolConnection' and 'Connection'
Hello, I was giving v3.0.0-rc1 a spin and noticed the following issue:
node_modules/mysql2/index.d.ts:86:18 - error TS2320: Interface 'PoolConnection' cannot simultaneously extend types 'PoolConnection' and 'Connection'.
Named property 'execute' of types 'PoolConnection' and 'Connection' are not identical.
86 export interface PoolConnection extends mysql.PoolConnection, Connection {
~~~~~~~~~~~~~~
This was noticed with Typescript version 4.5.5, though I also just tested with 4.9.3 and confirmed it occurs there too.
Edit: A note that for this to come up when the library is in use; ensure skipLibCheck
isn’t true
.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 12
- Comments: 18 (5 by maintainers)
Commits related to this issue
- ⬇ Downgrade mysql2 to fix build error. See https://github.com/sidorares/node-mysql2/issues/1722 — committed to clanquest/questbot by tomrijnbeek a year ago
- 👷♂️ Rewrite the bot to use slash commands (#26) * 🔥 Remove webhook functionality * 🚧 Reimplement commands * 🔥 Remove unnecessary dependencies * 📝 Update README * ⬇ Downgrade mysql2 ... — committed to clanquest/questbot by tomrijnbeek a year ago
"skipLibCheck": true,
@wellwelwel should be in npm as v3.2.1 in a minute
https://github.com/sidorares/node-mysql2/pull/1951
https://github.com/sidorares/node-mysql2/releases/tag/v3.2.1
I really want to fix, just don’t have enough time. If anyone wants to help that would be great
Sorry @sidorares, I missed your first ping. Gave this a test and can confirm it doesn’t happen in
v3.3.1
.Thanks!
@sidorares Just a matter of importing the promise version of the library in a Typescript project with
"skipLibCheck": false
.So to replicate it:
npm init
npm i mysql2@3.0.0-rc.1 typescript
npx tsc --init
tsconfig.json
, go to the bottom and set “skipLibCheck” tofalse
index.ts
, with the contentimport * as mysql from 'mysql2/promise';
npx tsc
and observe the errorDoes not seem to fix it:
Once the
PoolConnection.d.ts
has already declared extending theConnection
:Then it doesn’t need to re extends the
Connection
inindex.d.ts
#86
like:So, just by removing the
Connection
from extends inindex.d.ts
, it will work:I cloned the
3.2.0
release and tested it in a real use, it works perfectly.@sidorares, can I submit a
PR
for a change that is too small?I don’t think @sidorares is going to fix this. See #1792.