v2.15.3 broke Pool definition
joefallon opened this issue · 6 comments
joefallon commented
Version 2.15.3
The following error occurs when attempting to use a type of Pool.
Error:(12, 42) TS2345: .
Types of property 'config' are incompatible.
Type 'PoolConfig' is not assignable to type 'PoolConfig'. Two different types with this name exist, but they are unrelated.
Types of property 'typeCast' are incompatible.
Type 'TypeCast' is not assignable to type 'TypeCast'. Two different types with this name exist, but they are unrelated.
Type '(field: FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(...' is not assignable to type 'TypeCast'.
Type '(field: FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(...' is not assignable to type '(field: FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(...'. Two different types with this name exist, but they are unrelated.
Types of parameters 'field' and 'field' are incompatible.
Type 'FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(): Geome...' is not assignable to type 'FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(): Geome...'. Two different types with this name exist, but they are unrelated.
Type 'FieldInfo & { type: string; length: number; string(): string; buffer(): Buffer; geometry(): Geome...' is not assignable to type 'FieldInfo'.
Types of property 'type' are incompatible.
Type '(Types.DECIMAL & string) | (Types.TINY & string) | (Types.SHORT & string) | (Types.LONG & string)...' is not assignable to type 'Types'.
Type 'Types.DECIMAL & string' is not assignable to type 'Types'.
Here is the snippet of code:
public constructor(pool: Pool) {
this._pool = pool;
this._gateway = new TableGateway(pool, 'users');
}
Here is the signature of TableGateway:
constructor(connectionPool: Pool, tableName: string, primaryKey?: string);
Downgrading to v2.15.2 fixes the issue.
TS version is 2.7.2
felixfbecker commented
This looks like you have the typings twice in your project.
joefallon commented
Here is the package.json file. Typings included once.
"devDependencies": {
"@types/mocha": "2.2.48",
"@types/node": "8.9.5",
"@types/sinon": "4.3.0",
"assert": "1.4.1",
"mocha": "5.0.4",
"numseq": "0.2.1",
"sinon": "4.4.6"
},
"dependencies": {
"@joefallon/mysql-date": "0.1.1",
"@types/mysql": "2.15.2",
"es6-promise": "4.2.4",
"mydal": "0.5.1",
"mysql": "2.15.0",
"tslib": "1.9.0"
}
felixfbecker commented
They can still be twice inside node_modules. What does npm ls @types/mysql
say?
joefallon commented
+-- @types/mysql@2.15.2
-- mydal@0.5.1
-- @types/mysql@2.15.2
felixfbecker commented
There you have it - mydal
has the version pinned to 2.15.2 so npm can't dedupe: https://github.com/joefallon/mydal/blob/d7c67138a2986c33510f6c413c0f402745f42c83/package.json#L36
joefallon commented
Thanks! 👍