Changelog - 2026-08-30
Where Clauses Now Type-Check the Value, Not Just the Column
Breaking Change EnhancementIn one line. TWhere<T> now checks that a where-clause value fits its column's type; a column name that does not exist on T was already rejected.
What changed
- Values are checked.
{ status: 123 }on astringcolumn no longer compiles. Before, every value wasany. TWhereOperators<V>. The 25 field operators fromQueryOperators(eq,gt,like,in,between,contains, ...), typed against the column's value type.TWhereValue<V>. A column's condition is a bare scalar, a barenull(the way to writeIS NULL), or an operator object.betweenandnotBetweenare typed as a[V, V]tuple.isoTimestampcolumns accept aDatedirectly, bare or inside an operator (gt,gte,lt,lte,between). No.toISOString()is needed, and call sites that already use it keep working.
Who is affected
- Code that passes a wrongly typed value for a real column. It compiled before and does not now. Correct the where clause; do not widen the type back.
- Code using
isoTimestampcolumns. No action needed. - JSON and JSONB columns are not covered. They are still declared
anyin application schemas, so a typo inside a JSON path stays silent. Typing JSON paths needs$type<>()on your jsonb columns first.
Breaking changes
WARNING
Any caller that passed a value of the wrong type for a real column now gets a compile error.
Before:
typescript
type Product = { id: number; status: string; price: number | null };
const where: TWhere<Product> = { status: 123 }; // compiledAfter:
typescript
import type { TWhere } from '@venizia/ignis-filter';
const valid: TWhere<Product> = { status: 'active', price: { gte: 10 } };
// @ts-expect-error - 123 is not a valid value for a string column.
const wrongType: TWhere<Product> = { status: 123 };Details
- The
Dateexception applies only to the brandedTIsoTimestamptype. A plaintextcolumn still rejects aDate. - Reading an
isoTimestampcolumn back is unchanged:TIsoTimestampis a subtype ofstring.