type ResultTypeFromSelect<TSelectObject> = IsAny<TSelectObject> extends true ? any : WithoutRefBrand<Prettify<{ [K in keyof TSelectObject]: NeedsExtraction<TSelectObject[K]> extends true ? ExtractExpressionType<TSelectObject[K]> : TSelectObject[K] extends ToArrayWrapper<infer T> ? T[] : TSelectObject[K] extends ConcatToArrayWrapper<any> ? string : TSelectObject[K] extends QueryBuilder<infer TChildContext> ? Collection<GetResult<TChildContext>> : TSelectObject[K] extends Ref<infer _T> ? ExtractRef<(...)[(...)]> : (...)[(...)] extends RefLeaf<(...)> ? (...) extends (...) ? (...) : (...) : (...) extends (...) ? (...) : (...) }>>;
Defined in: packages/db/src/query/builder/types.ts:309
ResultTypeFromSelect - Infers the result type from a select object
This complex type transforms the input to select() into the actual TypeScript type that the query will return. It handles all the different kinds of values that can appear in a select clause:
Ref/RefProxy Extraction:
Expression Types:
JavaScript Literals (pass through as-is):
Nested Objects (recursive):
Example transformation:
// Input:
{ id: Ref<number>, name: Ref<string>, status: 'active', count: 42, profile: { bio: Ref<string> } }
// Output:
{ id: number, name: string, status: 'active', count: 42, profile: { bio: string } }
TSelectObject