Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/generator/01-base/static/queriesWithQueryLanguage.ts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ export type CountQuery<F> = {
where?: QueryFilter<F>;
};

type ContainsArray<T> =
T extends any[] ? true : never;

type NonArrayProps<T> = {
[K in keyof T as [ContainsArray<T[K]>] extends [never] ? K : never]: T[K]
};

Comment thread
SH-Exact marked this conversation as resolved.
type SomeQueryBase<E, F, I, P> = {
serializeNulls?: boolean;
include?: I;
Expand All @@ -173,7 +180,7 @@ type SomeQueryBase<E, F, I, P> = {
};

export type SomeQuery<E, F, I, P> = SomeQueryBase<E, F, I, P> &
({ sort?: Sort<E>[]; orderBy?: never } | { sort?: never; orderBy?: OrderBy<F>[] });
({ sort?: Sort<E>[]; orderBy?: never } | { sort?: never; orderBy?: OrderBy<NonArrayProps<F>>[] });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still possible to use array properties in the orderBy query. In the following example the topics prop of opportunity entity is available.

Image


const comparisonOperatorList: ComparisonOperator[] = [
'EQ',
Expand Down
Loading