Skip to content

Commit f4626fc

Browse files
committed
fix for arrays.
1 parent d3b842c commit f4626fc

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/query-builder/function-module.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
IsNever,
2323
ShallowDehydrateObject,
2424
ShallowDehydrateValue,
25+
Simplify,
2526
} from '../util/type-utils.js'
2627
import { AggregateFunctionBuilder } from './aggregate-function-builder.js'
2728
import { SelectQueryBuilderExpression } from '../query-builder/select-query-builder-expression.js'
@@ -720,9 +721,9 @@ export interface FunctionModule<DB, TB extends keyof DB> {
720721
DB,
721722
TB,
722723
T extends TB
723-
? ShallowDehydrateObject<Selectable<DB[T]>>[]
724+
? Simplify<ShallowDehydrateObject<Selectable<DB[T]>>>[]
724725
: T extends Expression<infer O>
725-
? ShallowDehydrateObject<O>[]
726+
? Simplify<ShallowDehydrateObject<O>>[]
726727
: never
727728
>
728729

@@ -760,9 +761,9 @@ export interface FunctionModule<DB, TB extends keyof DB> {
760761
DB,
761762
TB,
762763
T extends TB
763-
? ShallowDehydrateObject<Selectable<DB[T]>>
764+
? Simplify<ShallowDehydrateObject<Selectable<DB[T]>>>
764765
: T extends Expression<infer O>
765-
? ShallowDehydrateObject<O>
766+
? Simplify<ShallowDehydrateObject<O>>
766767
: never
767768
>
768769
}

src/util/type-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,10 @@ export type ShallowDehydrateObject<O> = {
233233
*
234234
* For now, we catch anything in {@link StringsWhenDataTypeNotAvailable} and convert it to `string`.
235235
*/
236-
export type ShallowDehydrateValue<T> = T extends (infer U)[] | null | undefined
237-
? ShallowDehydrateValue<U>[] | Extract<T, null | undefined>
236+
export type ShallowDehydrateValue<T> = [T] extends [
237+
(infer U)[] | null | undefined,
238+
]
239+
? Array<ShallowDehydrateValue<U>> | Extract<T, null | undefined>
238240
: T extends Exclude<T, StringsWhenDataTypeNotAvailable>
239241
? T
240242
: string | Exclude<T, StringsWhenDataTypeNotAvailable>

0 commit comments

Comments
 (0)