From d85e28ff9731134fbcd0555b0343df743f98f6cb Mon Sep 17 00:00:00 2001 From: Rosetta Roberts Date: Fri, 12 Nov 2021 22:55:07 -0600 Subject: [PATCH] Fixed aria text formatter types --- src/Range.tsx | 2 +- src/Slider.tsx | 4 ++-- tests/type.test.tsx | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Range.tsx b/src/Range.tsx index 2b3e4959f..65218472d 100644 --- a/src/Range.tsx +++ b/src/Range.tsx @@ -56,7 +56,7 @@ export interface RangeProps extends GenericSliderProps { tabIndex?: number | number[]; ariaLabelGroupForHandles?: string | string[]; ariaLabelledByGroupForHandles?: string | string[]; - ariaValueTextFormatterGroupForHandles?: string | string[]; + ariaValueTextFormatterGroupForHandles?: ((value: number) => string)[]; handle?: SliderProps['handle']; draggableTrack?: boolean; } diff --git a/src/Slider.tsx b/src/Slider.tsx index f3c98d2ae..77ad0711a 100644 --- a/src/Slider.tsx +++ b/src/Slider.tsx @@ -25,7 +25,7 @@ export interface SliderProps extends GenericSliderProps { tabIndex?: number; ariaLabelForHandle?: string; ariaLabelledByForHandle?: string; - ariaValueTextFormatterForHandle?: string; + ariaValueTextFormatterForHandle?: (value: number) => string; startPoint?: number; handle?: (props: { className: string; @@ -42,7 +42,7 @@ export interface SliderProps extends GenericSliderProps { tabIndex?: number; ariaLabel: string; ariaLabelledBy: string; - ariaValueTextFormatter: string; + ariaValueTextFormatter?: (value: number) => string; style?: React.CSSProperties; ref?: React.Ref; }) => React.ReactElement; diff --git a/tests/type.test.tsx b/tests/type.test.tsx index 09b1d4cec..e94b2f71c 100644 --- a/tests/type.test.tsx +++ b/tests/type.test.tsx @@ -1,9 +1,9 @@ import React from 'react'; import Slider, { createSliderWithTooltip, Range, Handle } from '../src'; -import { SliderProps } from '../src/Slider'; -import { RangeProps } from '../src/Range'; -import { HandleProps } from '../src/Handle'; -import { ComponentWrapperProps } from '../src/createSliderWithTooltip'; +import type { SliderProps } from '@/Slider'; +import type { RangeProps } from '@/Range'; +import type { HandleProps } from '@/Handle'; +import type { ComponentWrapperProps } from '@/createSliderWithTooltip'; describe('Slider.Typescript', () => { const sliderProps: SliderProps = { @@ -28,7 +28,7 @@ describe('Slider.Typescript', () => { tabIndex: 1, ariaLabelForHandle: 'ariaLabelForHandle', ariaLabelledByForHandle: 'ariaLabelledByForHandle', - ariaValueTextFormatterForHandle: 'ariaValueTextFormatterForHandle', + ariaValueTextFormatterForHandle: (i: number) => `ariaValueTextFormatterForHandle${i}`, startPoint: 1, handle(props) { return ; @@ -78,7 +78,7 @@ describe('Slider.Typescript', () => { handleStyle: [{}], ariaLabelGroupForHandles: 'ariaLabelGroupForHandles', ariaLabelledByGroupForHandles: ['ariaLabelledByGroupForHandles'], - ariaValueTextFormatterGroupForHandles: ['ariaValueTextFormatterGroupForHandles'], + ariaValueTextFormatterGroupForHandles: [(i: number) => `ariaValueTextFormatterGroupForHandles${i}`], handle(props) { return ; },