I'm trying to insert a row into my Postgres database with Kysely, and it appears that the types provided by kysely-codegen are making it impossible. When running the following code, I get a Typescript error that says:
Type 'ColumnType<number, number | undefined, number>' is not assignable to type 'ValueExpression<DB, DB_TABLE.Address, number>'.
My code:
db.insertInto('address').values(
{
...values
userId: user.id // error here
}
)
And here are my generated types for the address table:
export interface Address {
city: string;
country: string;
id: Generated<number>;
secondary: string;
state: string;
street: string;
userId: number;
zipcode: string;
}
Am I missing something here? I feel like I should be able to take the id
property from a user and assign userId
to that value, but Typescript disagrees.
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