You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETABLEproducers
( id INT UNIQUE NOT NULL
, title TEXTNOT NULL
, phone TEXTNOT NULL
, address TEXTNOT NULL
, city TEXTNOT NULL
, zip_code TEXTNOT NULL
)
And this code produces a typescript error(TS2344):
interfaceProducerRecord{id: numbertitle: stringphone: stringaddress: stringcity: stringzip_code: string}exportfunctionfetchProducer(id: number){conststmt=db.prepare('SELECT * FROM producers WHERE id=?;')constdatum=stmt.get<ProducerRecord>(id)if(datum){return{
...datum,address: datum.address ? datum.address.split('\n') : []}}returnnull}
This is the error I get:
error: TS2344 [ERROR]: Type 'ProducerRecord' does not satisfy the constraint 'Record<string, unknown>'.
Index signature for type 'string' is missing in type 'ProducerRecord'.
const datum = stmt.get<ProducerRecord>(id)
I have this table:
And this code produces a typescript error(TS2344):
This is the error I get:
If I ignore this statement with:
It works.
yet the documentation suggests that this is what is expected .
Did I miss something ?
The text was updated successfully, but these errors were encountered: