Closed mirnpnh closed 4 years ago
Here is the error I am seeing on this
tsc --noEmit node_modules/@types/mysql/index.d.ts(2,1): error TS2440: Import declaration conflicts with local declaration of 'Connection'. node_modules/@types/mysql/index.d.ts(4,1): error TS2440: Import declaration conflicts with local declaration of 'PoolConnection'. node_modules/@types/mysql/index.d.ts(5,1): error TS2440: Import declaration conflicts with local declaration of 'Pool'. node_modules/@types/mysql/index.d.ts(7,1): error TS2440: Import declaration conflicts with local declaration of 'PoolCluster'. node_modules/@types/mysql/index.d.ts(9,1): error TS2440: Import declaration conflicts with local declaration of 'Query'. npm ERR! code ELIFECYCLE
I'm seeing the same issue when upgrading typescript from 3.4.3 to 3.7.2. Specifically, I am getting the following:
node_modules/@types/mysql/index.d.ts:2:1 - error TS2440: Import declaration conflicts with local declaration of 'Connection'.
2 import Connection = require('./lib/Connection');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/mysql/index.d.ts:4:1 - error TS2440: Import declaration conflicts with local declaration of 'PoolConnection'.
4 import PoolConnection = require('./lib/PoolConnection');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/mysql/index.d.ts:5:1 - error TS2440: Import declaration conflicts with local declaration of 'Pool'.
5 import Pool = require('./lib/Pool');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/mysql/index.d.ts:7:1 - error TS2440: Import declaration conflicts with local declaration of 'PoolCluster'.
7 import PoolCluster = require('./lib/PoolCluster');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/mysql/index.d.ts:9:1 - error TS2440: Import declaration conflicts with local declaration of 'Query'.
9 import Query = require('./lib/protocol/sequences/Query');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The issue seems to be when defining a variable name via an import statement, i.e.:
import Connection = require('./lib/Connection');
then later exporting the same variable name:
export interface Connection extends Connection {}
is the cause of this issue.
PR with fix: https://github.com/types/mysql/pull/13
I don't think these typings support types/mysql
beyond 2.0.0
, so that PR doesn't appear to help (yet)?
Scratch that, it looks like types/mysql
did not change version (minor or otherwise). I can't seem to get types/mysql2
to realise they've updated, though.
You could consider changing the dependency to https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mysql ?
npm install @types/mysql should do
@theFroh how about pointing to an specific commit: github:types/mysql#7d612ffd3f9d81c09df9daac09bb2d49a3c286d0
Any news about this? I have the same issue.
same issue here
This should be all good now with #35 - the master branch for types/mysql is now being pulled in as a dependency rather than the v.2.0.0 branch.
to be sure you get the updated dependencies: rm -rf your node_modules (or just the types/mysql2 folder) delete the package-lock file npm install
Now it's working. Thanks!
Sorry to bump a dead topic, but which versions should I have in my package.json file for @types/mysql2? I've tried clearing my node_modules folder, removing and adding @types/mysql2, and I can never seem to get things to line up. Current when I try to add @types/mysql2 yarn tells me it cannot even find the package. Can someone show me what my package.json file should look like?
@whiterook6 - Make sure your package-lock.json is removed, too. We have "mysql2": "^1.3.5", in the dependencies and "@types/mysql2": "github:types/mysql2", in dev dependencies in our package.json
@jkruse14, even with those versions, typescript 3.7 is throwing errors. import xxx = require.....
Hello, It seems the library can't be used with ts 3.7 due to newly fixed recursive import/export. Actually the recursive import/export is in @types/mysql files but that is affecting this package too.