Typescript Error

Anyone know why this is happening? I upgraded my drizzle version so maybe something changed?
No description
6 Replies
Headless
HeadlessOP7mo ago
Any ideas? Was the type changed in newer versions? ;c
Sillvva
Sillvva7mo ago
Looks like MySqlRawQueryResult is a tuple. The first element response[0] is of type ResultSetHeader which has the affectedRows property. Try response?.[0]?.affectedRows
Headless
HeadlessOP7mo ago
This worked thank you, where did you find the type? I could not find it in docs anywhere
Sillvva
Sillvva7mo ago
It's not in the docs as far as I can tell. I searched for MySqlRawQueryResult in the source code
Sillvva
Sillvva7mo ago
If you import the type like this
import type { MySqlRawQueryResult } from "drizzle-orm/mysql2";
import type { MySqlRawQueryResult } from "drizzle-orm/mysql2";
In VS Code, you can right click and go to type definition.
No description
Sillvva
Sillvva7mo ago
That shows a type like:
export type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];
export type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];
And you can keep following the type definitions
Want results from more Discord servers?
Add your server