I used kysely-codegen and it spit out something like the following:
export type Int8 = ColumnType<
string,
bigint | number | string,
bigint | number | string
>;
export interface UserTable {
...
phoneOneCountryId: Generated<Int8>;
...
}
Which I then wrap:
export type NewUser = Insertable<UserTable>;
However when I go to use like so:
const testNewUser: NewUser = {
...
phoneOneCountryId: 20,
...
};
I get compilation error:
Type 'number' is not assignable to type 'Int8'.ts(2322)
If I understand how codegen set up Int8 correctly with ColumnType then it passed
bigint | number | string,
as the InsertType (middle arg). So I wouldn’t expect this to error – what am I missing here?