You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(db): use Ref<T, Nullable> for left join select refs instead of Ref<T> | undefined (#1262)
* test(db): add type tests for left join select ref direct property access
Declarative select callback types currently use `Ref<T> | undefined` for
left-joined tables, forcing optional chaining. Since the callback receives
proxy refs that are always truthy, this is misleading and encourages
runtime conditional patterns that silently fail. These tests assert the
desired behavior: direct property access without optional chaining, with
nullability reflected only in the result type.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* test(db): add right join and full join type tests for select ref direct access
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(db): use Ref<T, Nullable> brand instead of Ref<T> | undefined for nullable join refs
The declarative select() callback receives proxy objects that record property
accesses. These proxies are always truthy, but nullable join sides were typed
as Ref<T> | undefined, misleading users into using ?. and ?? operators that
have no effect at runtime. This changes nullable join refs to Ref<T, true>,
which allows direct property access while correctly producing T | undefined
in the result type.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* ci: apply automated fixes
* chore: add changeset for nullable join ref typing fix
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
fix(db): use `Ref<T, Nullable>` brand instead of `Ref<T> | undefined` for nullable join refs in declarative select
6
+
7
+
The declarative `select()` callback receives proxy objects that record property accesses. These proxies are always truthy at build time, but nullable join sides (left/right/full) were typed as `Ref<T> | undefined`, misleading users into using `?.` and `??` operators that have no effect at runtime. Nullable join refs are now typed as `Ref<T, true>`, which allows direct property access without optional chaining while correctly producing `T | undefined` in the result type.
0 commit comments