diff --git a/src/plugins/data/public/search/aggs/metrics/bucket_avg_fn.ts b/src/plugins/data/public/search/aggs/metrics/bucket_avg_fn.ts index f4f7dd5f93600..56643a2df54bd 100644 --- a/src/plugins/data/public/search/aggs/metrics/bucket_avg_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/bucket_avg_fn.ts @@ -88,11 +88,6 @@ export const aggBucketAvg = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customBucket = args.customBucket?.value ? { ...args.customBucket.value } : undefined; - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -102,8 +97,8 @@ export const aggBucketAvg = (): FunctionDefinition => ({ type: METRIC_TYPES.AVG_BUCKET, params: { ...rest, - customBucket, - customMetric, + customBucket: args.customBucket?.value, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/bucket_max_fn.ts b/src/plugins/data/public/search/aggs/metrics/bucket_max_fn.ts index 5d8c22b7886cd..896e9cf839605 100644 --- a/src/plugins/data/public/search/aggs/metrics/bucket_max_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/bucket_max_fn.ts @@ -88,11 +88,6 @@ export const aggBucketMax = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customBucket = args.customBucket?.value ? { ...args.customBucket.value } : undefined; - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -102,8 +97,8 @@ export const aggBucketMax = (): FunctionDefinition => ({ type: METRIC_TYPES.MAX_BUCKET, params: { ...rest, - customBucket, - customMetric, + customBucket: args.customBucket?.value, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/bucket_min_fn.ts b/src/plugins/data/public/search/aggs/metrics/bucket_min_fn.ts index b9914fd0439e4..2ae3d9211227a 100644 --- a/src/plugins/data/public/search/aggs/metrics/bucket_min_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/bucket_min_fn.ts @@ -88,11 +88,6 @@ export const aggBucketMin = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customBucket = args.customBucket?.value ? { ...args.customBucket.value } : undefined; - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -102,8 +97,8 @@ export const aggBucketMin = (): FunctionDefinition => ({ type: METRIC_TYPES.MIN_BUCKET, params: { ...rest, - customBucket, - customMetric, + customBucket: args.customBucket?.value, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/bucket_sum_fn.ts b/src/plugins/data/public/search/aggs/metrics/bucket_sum_fn.ts index 35a599a402fe1..eceb11a90f293 100644 --- a/src/plugins/data/public/search/aggs/metrics/bucket_sum_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/bucket_sum_fn.ts @@ -88,11 +88,6 @@ export const aggBucketSum = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customBucket = args.customBucket?.value ? { ...args.customBucket.value } : undefined; - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -102,8 +97,8 @@ export const aggBucketSum = (): FunctionDefinition => ({ type: METRIC_TYPES.SUM_BUCKET, params: { ...rest, - customBucket, - customMetric, + customBucket: args.customBucket?.value, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/cumulative_sum_fn.ts b/src/plugins/data/public/search/aggs/metrics/cumulative_sum_fn.ts index 65c9958c8ebd2..1c2ed87ba2055 100644 --- a/src/plugins/data/public/search/aggs/metrics/cumulative_sum_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/cumulative_sum_fn.ts @@ -93,10 +93,6 @@ export const aggCumulativeSum = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -106,7 +102,7 @@ export const aggCumulativeSum = (): FunctionDefinition => ({ type: METRIC_TYPES.CUMULATIVE_SUM, params: { ...rest, - customMetric, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/derivative_fn.ts b/src/plugins/data/public/search/aggs/metrics/derivative_fn.ts index b6557d5f99219..e97a7813b2ca6 100644 --- a/src/plugins/data/public/search/aggs/metrics/derivative_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/derivative_fn.ts @@ -93,10 +93,6 @@ export const aggDerivative = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -106,7 +102,7 @@ export const aggDerivative = (): FunctionDefinition => ({ type: METRIC_TYPES.DERIVATIVE, params: { ...rest, - customMetric, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/moving_avg_fn.ts b/src/plugins/data/public/search/aggs/metrics/moving_avg_fn.ts index bd0806eb4effb..662853d5412ff 100644 --- a/src/plugins/data/public/search/aggs/metrics/moving_avg_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/moving_avg_fn.ts @@ -106,10 +106,6 @@ export const aggMovingAvg = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -119,7 +115,7 @@ export const aggMovingAvg = (): FunctionDefinition => ({ type: METRIC_TYPES.MOVING_FN, params: { ...rest, - customMetric, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, }, diff --git a/src/plugins/data/public/search/aggs/metrics/serial_diff_fn.ts b/src/plugins/data/public/search/aggs/metrics/serial_diff_fn.ts index f9635c092947a..6d991624f1652 100644 --- a/src/plugins/data/public/search/aggs/metrics/serial_diff_fn.ts +++ b/src/plugins/data/public/search/aggs/metrics/serial_diff_fn.ts @@ -93,10 +93,6 @@ export const aggSerialDiff = (): FunctionDefinition => ({ fn: (input, args) => { const { id, enabled, schema, ...rest } = args; - // Need to spread this object to work around TS bug: - // https://github.com/microsoft/TypeScript/issues/15300#issuecomment-436793742 - const customMetric = args.customMetric?.value ? { ...args.customMetric.value } : undefined; - return { type: 'agg_type', value: { @@ -106,7 +102,7 @@ export const aggSerialDiff = (): FunctionDefinition => ({ type: METRIC_TYPES.SERIAL_DIFF, params: { ...rest, - customMetric, + customMetric: args.customMetric?.value, json: getParsedValue(args, 'json'), }, },