Given the following schema:
CREATE table bookshelf(
id bigserial NOT NULL,
book_ids bigint[] NOT NULL);
The generated type is as follows:
export interface Bookshelf {
id: Generated<Int8>
book_ids: Int8[]
}
This type does not accept an array of numbers. The following code doesn't compile with Type number[] is not assignable to type Int8[]
await db
.insertInto('bookshelf')
.values({
book_ids: [12, 23]
})
.execute()
However, if the array type is changed to the following as suggested in kysely-org/kysely#957 (comment), the same code compiles:
type Int8Array = ColumnType<
SelectType<Int8>[],
InsertType<Int8>[],
UpdateType<Int8>[]
>;
export interface Bookshelf {
id: Generated<Int8>
book_ids: Int8Array
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too