From c86e1498442e03232d2afaa62ac18159aa58af07 Mon Sep 17 00:00:00 2001 From: Maryia Lapata Date: Tue, 24 Sep 2019 16:40:16 +0300 Subject: [PATCH] RangeOption: Get rid of ts-ignore (#45902) (#46444) * Get rid of ts-ignore * Update range.tsx * Refactoring --- .../public/components/common/range.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/legacy/core_plugins/kbn_vislib_vis_types/public/components/common/range.tsx b/src/legacy/core_plugins/kbn_vislib_vis_types/public/components/common/range.tsx index 3ee05345524e6..a31b06fdbcc46 100644 --- a/src/legacy/core_plugins/kbn_vislib_vis_types/public/components/common/range.tsx +++ b/src/legacy/core_plugins/kbn_vislib_vis_types/public/components/common/range.tsx @@ -18,7 +18,7 @@ */ import React, { useState } from 'react'; -import { EuiFormRow, EuiRange } from '@elastic/eui'; +import { EuiFormRow, EuiRange, EuiRangeProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; interface RangeOptionProps { @@ -50,10 +50,9 @@ function RangeOption({ values: { min, max }, }); - const onChangeHandler = ( - { target: { valueAsNumber } }: React.ChangeEvent, - isValid: boolean - ) => { + const onChangeHandler: EuiRangeProps['onChange'] = (event, isValid) => { + const { valueAsNumber } = event.target as HTMLInputElement; // since we don't show ticks on EuiRange, the target will definitely be HTMLInputElement type, so we can cast it directly. + setStateValue(valueAsNumber); setIsValidState(isValid); @@ -72,7 +71,6 @@ function RangeOption({ showInput={showInput} step={step} value={stateValue} - // @ts-ignore onChange={onChangeHandler} />