kysely
kysely copied to clipboard
Allow `string` argument when `regexp`- or `like`-ing an enum column
When filtering an enum column, e.g.
interface Database {
Pet: {
species: "dog" | "cat" | "hamster";
};
}
with "regexp" or "like"
db.selectFrom("Pet")
.where("species", "regexp", "ste") // ❌ Argument of type '"ste"' is not assignable to parameter of type 'OperandValueExpressionOrList<Database, "Pet", "species">'.(2345)
.where("species", "like", "%ste%") // ❌ Argument of type '"%ste%"' is not assignable to parameter of type 'OperandValueExpressionOrList<Database, "Pet", "species">'.(2345)
the types leading to the type errors above seem too strict to me.
What do you think about broadening the type to string for the right-hand side argument of "regexp" and "like"?