Skip to content

Commit 68e06cf

Browse files
authored
Fixed aria text formatter types (#801)
1 parent 4b17b3d commit 68e06cf

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Range.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface RangeProps extends GenericSliderProps {
5656
tabIndex?: number | number[];
5757
ariaLabelGroupForHandles?: string | string[];
5858
ariaLabelledByGroupForHandles?: string | string[];
59-
ariaValueTextFormatterGroupForHandles?: string | string[];
59+
ariaValueTextFormatterGroupForHandles?: ((value: number) => string)[];
6060
handle?: SliderProps['handle'];
6161
draggableTrack?: boolean;
6262
}

src/Slider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface SliderProps extends GenericSliderProps {
2525
tabIndex?: number;
2626
ariaLabelForHandle?: string;
2727
ariaLabelledByForHandle?: string;
28-
ariaValueTextFormatterForHandle?: string;
28+
ariaValueTextFormatterForHandle?: (value: number) => string;
2929
startPoint?: number;
3030
handle?: (props: {
3131
className: string;
@@ -42,7 +42,7 @@ export interface SliderProps extends GenericSliderProps {
4242
tabIndex?: number;
4343
ariaLabel: string;
4444
ariaLabelledBy: string;
45-
ariaValueTextFormatter: string;
45+
ariaValueTextFormatter?: (value: number) => string;
4646
style?: React.CSSProperties;
4747
ref?: React.Ref<any>;
4848
}) => React.ReactElement;

tests/type.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22
import Slider, { createSliderWithTooltip, Range, Handle } from '../src';
3-
import { SliderProps } from '../src/Slider';
4-
import { RangeProps } from '../src/Range';
5-
import { HandleProps } from '../src/Handle';
6-
import { ComponentWrapperProps } from '../src/createSliderWithTooltip';
3+
import type { SliderProps } from '@/Slider';
4+
import type { RangeProps } from '@/Range';
5+
import type { HandleProps } from '@/Handle';
6+
import type { ComponentWrapperProps } from '@/createSliderWithTooltip';
77

88
describe('Slider.Typescript', () => {
99
const sliderProps: SliderProps = {
@@ -28,7 +28,7 @@ describe('Slider.Typescript', () => {
2828
tabIndex: 1,
2929
ariaLabelForHandle: 'ariaLabelForHandle',
3030
ariaLabelledByForHandle: 'ariaLabelledByForHandle',
31-
ariaValueTextFormatterForHandle: 'ariaValueTextFormatterForHandle',
31+
ariaValueTextFormatterForHandle: (i: number) => `ariaValueTextFormatterForHandle${i}`,
3232
startPoint: 1,
3333
handle(props) {
3434
return <span {...props} />;
@@ -78,7 +78,7 @@ describe('Slider.Typescript', () => {
7878
handleStyle: [{}],
7979
ariaLabelGroupForHandles: 'ariaLabelGroupForHandles',
8080
ariaLabelledByGroupForHandles: ['ariaLabelledByGroupForHandles'],
81-
ariaValueTextFormatterGroupForHandles: ['ariaValueTextFormatterGroupForHandles'],
81+
ariaValueTextFormatterGroupForHandles: [(i: number) => `ariaValueTextFormatterGroupForHandles${i}`],
8282
handle(props) {
8383
return <span {...props} />;
8484
},

0 commit comments

Comments
 (0)