node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

typescript error

Open kouxin opened this issue 3 years ago • 4 comments

类型“typeof import("D:/project/workbench-node-serve/node_modules/mysql2/promise")”上不存在属性“raw”

kouxin avatar Jan 04 '22 02:01 kouxin

Sorry @kouxin I need more context to be able to help. Also I can only speak English and Russian

sidorares avatar Jan 13 '22 12:01 sidorares

Sorry @kouxin I need more context to be able to help. Also I can only speak English and Russian

mysql.raw typeof import("D:/project/workbench-node-serve/node_modules/mysql2/index") not exiset “raw”, actually it was exiseted;

kouxin avatar Jan 21 '22 02:01 kouxin

I actually had the same issue (I think). What I believe @kouxin means, is that the Typescript definition files don't define an export for mysql.raw(), so TS users can't access it (even though it's exported by the underlying JS file).

It's exported here: https://github.com/sidorares/node-mysql2/blob/6fae0c20e7459b2dee6439a2cd2beab0c45ab08d/index.js#L49

But this is missing in the definitions file: https://github.com/sidorares/node-mysql2/blob/6fae0c20e7459b2dee6439a2cd2beab0c45ab08d/typings/mysql/index.d.ts#L11-L21

plungingChode avatar Jan 25 '22 11:01 plungingChode

@plungingChode you can update version

https://github.com/sidorares/node-mysql2/blob/ab3feb75bb4af1f6d288c0494a99aa2483ac24d5/typings/mysql/index.d.ts#L21-L23

yuxizhe avatar May 29 '22 20:05 yuxizhe

Thanks @yuxizhe 🙋🏻‍♂️

wellwelwel avatar Jul 09 '23 13:07 wellwelwel