Skip to content

Commit

Permalink
Handle StringLong in AggregationFromType<T> and MultipleAggregationFr…
Browse files Browse the repository at this point in the history
…omType<T>
  • Loading branch information
bryantpark04 committed Jul 24, 2024
1 parent 8721e12 commit d2419ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/legacy-client/src/client/interfaces/aggregations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type {
StringGroupBy,
TimestampGroupBy,
} from "../objectSets/aggregations/index.js";
import type { StringLong } from "../utils/StringLong.js";
import type { OmitMetadataProperties } from "./utils/OmitProperties.js";

export declare type ObjectTypesGroupByFunction<
Expand Down Expand Up @@ -111,15 +112,17 @@ export type GroupByFromType<T, N extends string> = NonNullable<T> extends number
: T extends Array<infer U> ? GroupByFromType<U, N>
: never;

export type AggregationFromType<T> = NonNullable<T> extends number
export type AggregationFromType<T> = NonNullable<T> extends StringLong
? AggregatableProperty<Double>
: NonNullable<T> extends number ? AggregatableProperty<Double>
: NonNullable<T> extends boolean ? AggregatableProperty<Double>
: NonNullable<T> extends LocalDate ? AggregatableProperty<LocalDate>
: NonNullable<T> extends Timestamp ? AggregatableProperty<Timestamp>
: AggregatableProperty<never>;

export type MultipleAggregationFromType<T> = NonNullable<T> extends number
export type MultipleAggregationFromType<T> = NonNullable<T> extends StringLong
? MultipleAggregatableProperty<Double>
: NonNullable<T> extends number ? MultipleAggregatableProperty<Double>
: NonNullable<T> extends boolean ? MultipleAggregatableProperty<Double>
: NonNullable<T> extends LocalDate ? MultipleAggregatableProperty<LocalDate>
: NonNullable<T> extends Timestamp ? MultipleAggregatableProperty<Timestamp>
Expand Down

0 comments on commit d2419ac

Please sign in to comment.