Wrapping set-op branches in parentheses, the standard form for per-branch ORDER BY or LIMIT, produces garbage instead of a row type:
Query<DB, '(select id from users) union (select id from archived_users)'>
// { [x: string]: unknown }[]
// strict: QueryTypeError<'unknown table: '>[] - note the empty table name
Expected { id: number }[]. This is valid in every dialect and the README claims UNION support.
Root cause, in two layers. ParseStatementNormalized (src/parse.ts:306-349) requires the first word to be a statement keyword, and (select matches nothing, so the parse is never. Then InferRowWithChecked (src/parse.ts:965-970) has no [never] guard: never extends { columns: infer ... } succeeds with every infer position resolving to never, which yields the index-signature row instead of a clean failure. That second layer is the same never extends {...} pattern behind #229 and the #243 batch, surfacing in one more spot.
Wrapping set-op branches in parentheses, the standard form for per-branch ORDER BY or LIMIT, produces garbage instead of a row type:
Expected
{ id: number }[]. This is valid in every dialect and the README claims UNION support.Root cause, in two layers.
ParseStatementNormalized(src/parse.ts:306-349) requires the first word to be a statement keyword, and(selectmatches nothing, so the parse isnever. ThenInferRowWithChecked(src/parse.ts:965-970) has no[never]guard:never extends { columns: infer ... }succeeds with every infer position resolving tonever, which yields the index-signature row instead of a clean failure. That second layer is the samenever extends {...}pattern behind #229 and the #243 batch, surfacing in one more spot.