Open caalberts opened 5 months ago
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[]
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 https://github.com/kysely-org/kysely/issues/957#issuecomment-2071085703, the same code compiles:
type Int8Array = ColumnType< SelectType<Int8>[], InsertType<Int8>[], UpdateType<Int8>[] >; export interface Bookshelf { id: Generated<Int8> book_ids: Int8Array }
Given the following schema:
The generated type is as follows:
This type does not accept an array of numbers. The following code doesn't compile with
Type number[] is not assignable to type Int8[]
However, if the array type is changed to the following as suggested in https://github.com/kysely-org/kysely/issues/957#issuecomment-2071085703, the same code compiles:
Upvote & Fund