Skip to content

Commit 550e476

Browse files
committed
Fix typecheck
1 parent 8809d7c commit 550e476

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import { AlertsContextValue } from '../../../../../triggers_actions_ui/public/ap
1212
import { AlertContextMeta } from '../types';
1313
import { MetricsExplorerMetric } from '../../../../common/http_api/metrics_explorer';
1414
import React from 'react';
15-
import { Expressions, defaultExpression } from './expression';
15+
import { Expressions } from './expression';
1616
import { act } from 'react-dom/test-utils';
1717
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
1818
import { Comparator } from '../../../../server/lib/alerting/metric_threshold/types';
1919

2020
jest.mock('../../../containers/source/use_source_via_http', () => ({
21-
useSourceViaHttp: (any) => ({
21+
useSourceViaHttp: () => ({
2222
source: { id: 'default' },
2323
createDerivedIndexPattern: () => ({ fields: [], title: 'metricbeat-*' }),
2424
}),

x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@ const previewOptions = [
643643
}),
644644
},
645645
];
646-
const previewDOMOptions = previewOptions.map((o) => omit(o, 'shortText'));
646+
const previewDOMOptions: Array<{ text: string; value: string }> = previewOptions.map((o) =>
647+
omit(o, 'shortText')
648+
);
647649

648650
const firedTimeLabel = i18n.translate('xpack.infra.metrics.alertFlyout.firedTime', {
649651
defaultMessage: 'time',

x-pack/plugins/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jest.mock('react-router-dom', () => ({
1818

1919
// Jest can't access variables outside the scope of the mock factory function except to
2020
// reassign them, so we can't make these both part of the same object
21-
let PREFILL_NODETYPE;
22-
let PREFILL_METRIC;
21+
let PREFILL_NODETYPE: WaffleOptionsState['nodeType'] | undefined;
22+
let PREFILL_METRIC: WaffleOptionsState['metric'] | undefined;
2323
jest.mock('../../../../alerting/use_alert_prefill', () => ({
2424
useAlertPrefillContext: () => ({
2525
inventoryPrefill: {
26-
setNodeType(nodeType: string) {
26+
setNodeType(nodeType: WaffleOptionsState['nodeType']) {
2727
PREFILL_NODETYPE = nodeType;
2828
},
29-
setMetric(metric: { type: string }) {
29+
setMetric(metric: WaffleOptionsState['metric']) {
3030
PREFILL_METRIC = metric;
3131
},
3232
},
@@ -46,7 +46,7 @@ describe('useWaffleOptions', () => {
4646

4747
const newOptions = {
4848
nodeType: 'pod',
49-
metriic: { type: 'memory' },
49+
metric: { type: 'memory' },
5050
} as WaffleOptionsState;
5151
act(() => {
5252
result.current.changeNodeType(newOptions.nodeType);

0 commit comments

Comments
 (0)