I’ve selected these two tables as an example, where both orderId
and categoryId
are foreign key integers with NOT NULL
constraints. On the surface, this seems fine, but when combined with the Insertable<Product>
type, I encounter an issue where categoryId
is typed as number | undefined
. This isn't accurate because categoryId
is expected to be a required foreign key integer.
Here’s the structure of the tables:
export interface Payment {
id: Generated<number>;
orderId: number; // Foreign key, non-nullable
}
export interface Product {
categoryId: Generated<number>; // Foreign key, non-nullable
id: Generated<number>;
}
Why does it happen? How to fix it?
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