I have a table areas with a column days_of_week_active (for example ['Mon', 'Tue']).
In my schema the column is days_of_week_active: Generated<string[]>;
, and it is generated because it has the default of all the days of the week:
.addColumn('days_of_week_active', sql`varchar(3)[]`, col => col.defaultTo(sql.raw(`ARRAY[${days_of_week.map(day => `'${day}'`).join(', ')}]`)).notNull())
The following example doesn't compile
const monAreas = db.selectFrom('areas')
.selectAll('areas')
.where((eb) => eb(
eb.val('Mon'), '=', eb.fn.any('areas.days_of_week_active')
)).execute();
I get the following typescript error:
Argument of type 'KyselyTypeError<"any(expr) call failed: expr must be an array">' is not assignable to parameter of type 'OperandValueExpressionOrList<DB, "areas", ExpressionWrapper<DB, "areas", string>>'.
If I temporarily remove Generated from the schema and set it to string[]
, then it works fine.
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