node-mysql2
node-mysql2 copied to clipboard
TypeError: FieldPacket type can't be used to access mysql.Types
When trying to access the Type of a certain field through the FieldPacket interface I get the following error in vs code:
I've tried using the type field and the column type field, but both are returning an error in the IDE. If I try to run the code with "npm run dev" it doesn't have any errors and returns the type correctly.
Hi @spiros132, could you provide a simple code example to reproduce this warning?
The following code returns the above error for me
import mysql from "mysql2";
export function Test(fields: mysql.FieldPacket[]) {
if(fields[0].type != undefined)
type: mysql.Types = mysql.Types[fields[0].type];
}
I'm also facing this after upgrading to ESM.