Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: FieldPacket type can't be used to access mysql.Types #3279

Open
spiros132 opened this issue Dec 11, 2024 · 2 comments
Open

TypeError: FieldPacket type can't be used to access mysql.Types #3279

spiros132 opened this issue Dec 11, 2024 · 2 comments

Comments

@spiros132
Copy link

When trying to access the Type of a certain field through the FieldPacket interface I get the following error in vs code:
image

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.

@wellwelwel
Copy link
Collaborator

Hi @spiros132, could you provide a simple code example to reproduce this warning?

@spiros132
Copy link
Author

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];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants