When inserting/searching on a BLOB column when using D1, D1 expects an ArrayBuffer. However, when using an array buffer, I get a type error: Argument of type 'ArrayBuffer' is not assignable to parameter of type 'OperandValueExpressionOrList<DB, "Slp", "hash">'. Type 'ArrayBuffer' is missing the following properties from type 'Buffer': write, toJSON, equals, compare, and 99 more
example (the hash column is type Bytes):
const fileHash = await crypto.subtle.digest(
"SHA-256",
file.buffer,
);
const alreadyExists = await db
.selectFrom('Slp')
.select('id')
.where('hash', '=', fileHash)
// error is here ^^^^^^^^
.executeTakeFirst();
Here the error is on "fileHash" in the where clause. I can get the type error to go away by doing Buffer.from(fileHash), however d1 throws a runtime error when i do that.
Not a huge issue, its just a type error so a ts-ignore makes it go away just thought i should report it.
When inserting/searching on a BLOB column when using D1, D1 expects an ArrayBuffer. However, when using an array buffer, I get a type error:
Argument of type 'ArrayBuffer' is not assignable to parameter of type 'OperandValueExpressionOrList<DB, "Slp", "hash">'. Type 'ArrayBuffer' is missing the following properties from type 'Buffer': write, toJSON, equals, compare, and 99 more
example (the hash column is type Bytes):
Here the error is on "fileHash" in the where clause. I can get the type error to go away by doing Buffer.from(fileHash), however d1 throws a runtime error when i do that.
Not a huge issue, its just a type error so a ts-ignore makes it go away just thought i should report it.