New as array/object option breaks Typescript
isaac-mcfadyen opened this issue ยท 4 comments
Hi!
I updated my Planetscale driver version today and Typescript started generating errors.
After a bit of investigation, it seems that Typescript is seeing that a row can now be an Array or an Object and defaulting to Array (so things like query.rows[0].row_name
break, even when specifying as
).
It seems to be this line. A row can either be an array or an object and array is preferred so it's underlined red.
Line 7 in 2ca73f8
I'm having the same issue when using strict type checking
It's questionable whether it's right to do so, but you can of course overwrite the definition of Row
by adding a planet scale.d.ts
file to the root of your project:
declare module '@planetscale/database' {
export type Row = Record<string, any>
}
That might be what I end up going with.