Patch Changes
-
96549f6: Resolve template-literal types (and branded
Money) totextwhen used as query parameters.A template-literal type such as
`${number}`or`${string}`is a string at runtime but had no corresponding PostgreSQL type, so passing one as a parameter required a manual cast or anoverrides.typesentry.checkTypenow maps any template-literal type totext(and an array of them totext[]), mirroring how a plainstringis handled. This also fixes brandedMoney(`${number}` & { __brand: "Money" }): the intersection branch resolves each member throughcheckType, and the`${number}`base now resolves totext, so the whole intersection maps totextwith no change to the intersection helper. Intrinsic string-mapping types (Uppercase<string>, etc.) resolve totextas well, and an explicitoverrides.typesentry still takes precedence. Passing a template-literal value where an incompatible column type is expected is still reported, and a template-literal intersected with a conflicting base type (e.g.`${number}`& Date) is rejected. -
96549f6: Resolve tuple types to their element type when used as query parameters.
A tuple such as
NonEmptyArray<T>([T, ...T[]]) has no corresponding PostgreSQL type, so passing one as a parameter forced a manualas T[]cast, a[...spread], or anoverrides.typesentry.checkTypenow resolves each element type of a tuple and, when they agree, maps the tuple to that element type's array (T[]) — mirroring how a real array is handled. Element resolution recurses, so branded elements likeNonEmptyArray<ID>still map totext[]. An empty tuple, an all-null tuple, or a heterogeneous tuple whose elements map to conflicting PostgreSQL types is rejected, and an explicitoverrides.typesentry still takes precedence.