Check types (#137410)

* Check types

* Fix types in discover temporary
This commit is contained in:
Stratoula Kalafateli 2022-07-28 19:52:13 +03:00 committed by GitHub
parent 2d554c078f
commit 1d6312b15d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 10 deletions

View file

@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n';
import { ExpressionFunctionDefinition, ExecutionContext } from '@kbn/expressions-plugin/common';
import { Adapters } from '@kbn/inspector-plugin/common';
import { Filter } from '@kbn/es-query';
import { Query, uniqFilters, AggregateQuery } from '@kbn/es-query';
import { Query, uniqFilters } from '@kbn/es-query';
import { unboxExpressionValue } from '@kbn/expressions-plugin/common';
import { SavedObjectReference } from '@kbn/core/types';
import { SavedObjectsClientCommon } from '@kbn/data-views-plugin/common';
@ -41,11 +41,8 @@ export type ExpressionFunctionKibanaContext = ExpressionFunctionDefinition<
const getParsedValue = (data: any, defaultValue: any) =>
typeof data === 'string' && data.length ? JSON.parse(data) || defaultValue : defaultValue;
const mergeQueries = (
first: Query | AggregateQuery | Array<Query | AggregateQuery> = [],
second: Query | AggregateQuery | Array<Query | AggregateQuery>
) =>
uniqBy<Query | AggregateQuery>(
const mergeQueries = (first: Query | Query[] = [], second: Query | Query[]) =>
uniqBy<Query>(
[...(Array.isArray(first) ? first : [first]), ...(Array.isArray(second) ? second : [second])],
(n: any) => JSON.stringify(n.query)
);

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { Filter, AggregateQuery } from '@kbn/es-query';
import { Filter } from '@kbn/es-query';
import { ExpressionValueBoxed, ExpressionValueFilter } from '@kbn/expressions-plugin/common';
import { Query, TimeRange } from '../../query';
import { adaptToExpressionValueFilter, DataViewField } from '../..';
@ -13,7 +13,7 @@ import { adaptToExpressionValueFilter, DataViewField } from '../..';
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type ExecutionContextSearch = {
filters?: Filter[];
query?: Query | AggregateQuery | Array<Query | AggregateQuery>;
query?: Query | Query[];
timeRange?: TimeRange;
};

View file

@ -45,7 +45,7 @@ export const createRegionMapFn = (): RegionMapExpressionFunctionDefinition => ({
},
},
async fn(input, args) {
const query = input.query as Query;
const query = input.query;
return {
type: 'render',
as: REGION_MAP_RENDER,

View file

@ -45,7 +45,7 @@ export const createTileMapFn = (): TileMapExpressionFunctionDefinition => ({
},
},
async fn(input, args) {
const query = input.query as Query;
const query = input.query;
return {
type: 'render',
as: TILE_MAP_RENDER,