Changelog - 2026-09-26
Typed JSON-Path Keys in TWhere<T>, and an Opt-In TOrderEntry<T>
EnhancementIn one line. TWhere<T> now type-checks a JSON-path key ('metadata.a.b') against T's JSON columns with no cast, and TOrderEntry<T> is a new opt-in type for checking an order list the same way.
What changed
TWhere<T>accepts a JSON-path key on a JSON column withoutas TWhere<T>orTWhere<any>. Before,{ 'metadata.a.b': 'value' } as TWhere<Product>was needed.TOrderEntry<T>checks an order list, opt-in throughsatisfies.- New exported types:
TJsonColumnKey<T>(columns whose value can hold JSON:unknown,any, or an object other thanDateorTIsoTimestamp),TJsonPathKey<T>, andTOrderEntry<T>, from@venizia/ignis-filter,@venizia/ignis-kerneland@venizia/ignis.
typescript
import type { TOrderEntry, TWhere } from '@venizia/ignis-filter';
type Product = { id: number; metadata: unknown };
const where: TWhere<Product> = { 'metadata.a.b': 'value' }; // compiles
const order = ['name DESC', 'metadata.rank asc'] satisfies TOrderEntry<Product & { name: string }>[];Who is affected
- Code that cast a dotted where key. The cast is no longer needed for a JSON column; it can stay or go.
- Everyone else. No runtime change in any dialect.
TFilter<T>.orderstaysstring[]. - Code that types a where clause
Record<string, unknown>still assigns toTWhere<T>for a row with a JSON column.
Details
Known limits:
- The value on a JSON-path key is
unknown. Only the column part is checked. A typo ('metdata.a') or a path on a non-JSON column ('score.a'on a number column) is a compile error, but any value on a valid JSON-path key compiles. - A relation-shaped object field counts as a JSON column at the type level.
'creator.name'type-checks even thoughcreatoris not a real column, and the runtime throwsColumn 'creator' is not a JSON column. - A JSON-path order entry's direction is not type-checked.
'metadata.rank sideways'still satisfiesTOrderEntry<T>; the runtime parser rejects an invalid direction.