mariadb-corporation / mariadb-connector-nodejs

MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.
GNU Lesser General Public License v2.1
366 stars 91 forks source link

return type for batch() is wrong on typescript #194

Closed juicycool92 closed 1 year ago

juicycool92 commented 2 years ago

mariadb version : 3.0.0 operating os : ubuntu 20.04

Hello, thanks for nice module!

i have a question about types for batch() function

please, see the look at my code screenshot first.

image

above code are working perfectly, and i want to look how many of rows are affected like this variable from this docs

but there is types error on my IDE image

i checked d.ts file and this look like array image

after that, i tried to log the result and what exactly result look like. [2022-03-15T03:18:41+00:00][logger][error]: {"affectedRows":1,"insertId":"0","warningStatus":0}

so, it looks like there is type declare error or i might be doin wrong totally. can you help me what did i do wrong?

Thanks!

antoHuman commented 2 years ago

I can confirm the same issue with the return type. The promise resolves with the UpsertResult object (e. g. {"affectedRows":2,"insertId":"10","warningStatus":0}), when inserting multiple values, not with an array of those.

Are there some cases for which it actually returns UpsertResult[]?

I guess we need to use // @ts-ignore for now, or override the interface?

mariadb version : 2.5.5 operating os : Windows 10

rusher commented 1 year ago

closing since corrected with CONJS-199 on 2.5.7/3.0.1