Skip to content

Commit

Permalink
Remove function to avoid extra any
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerry350 committed Jun 24, 2021
1 parent 9f48a76 commit 22d5945
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,7 @@ export const OptimizedGroupedSearchQueryResponseRT = rt.intersection([
aggregations: rt.type({
groups: rt.intersection([
rt.type({
buckets: rt.array(
rt.intersection([
bucketFieldsRT,
ChartPreviewBucketsRT,
])
),
buckets: rt.array(rt.intersection([bucketFieldsRT, ChartPreviewBucketsRT])),
}),
afterKeyRT,
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ const addHistogramAggregationToQuery = (
};

if (isGrouped) {
const isOptimizedQuery = (groupedQuery: any) =>
!groupedQuery.body.aggregations.groups.aggregations?.filtered_results ? true : false;
const isOptimizedQuery = !query.body.aggregations.groups.aggregations?.filtered_results;

if (isOptimizedQuery(query)) {
if (isOptimizedQuery) {
query.body.aggregations.groups.aggregations = {
...query.body.aggregations.groups.aggregations,
...histogramAggregation,
Expand Down

0 comments on commit 22d5945

Please sign in to comment.