mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
typescript: replace unknown & any with SliderRef (#42420)
This commit is contained in:
parent
7183eab0a9
commit
f1fda002a4
@ -1,12 +1,12 @@
|
||||
import classNames from 'classnames';
|
||||
import type { SliderProps as RcSliderProps } from 'rc-slider';
|
||||
import RcSlider from 'rc-slider';
|
||||
import * as React from 'react';
|
||||
import type { SliderRef } from 'rc-slider/lib/Slider';
|
||||
import React from 'react';
|
||||
import warning from '../_util/warning';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import type { TooltipPlacement } from '../tooltip';
|
||||
import warning from '../_util/warning';
|
||||
import SliderTooltip from './SliderTooltip';
|
||||
|
||||
import useStyle from './style';
|
||||
|
||||
export type SliderMarks = RcSliderProps['marks'];
|
||||
@ -97,14 +97,12 @@ interface SliderRange {
|
||||
|
||||
export type Opens = { [index: number]: boolean };
|
||||
|
||||
const Slider = React.forwardRef<unknown, SliderSingleProps | SliderRangeProps>(
|
||||
(props, ref: any) => {
|
||||
const Slider = React.forwardRef<SliderRef, SliderSingleProps | SliderRangeProps>((props, ref) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
range,
|
||||
className,
|
||||
rootClassName,
|
||||
|
||||
// Deprecated Props
|
||||
tooltipPrefixCls: legacyTooltipPrefixCls,
|
||||
tipFormatter: legacyTipFormatter,
|
||||
@ -235,8 +233,8 @@ const Slider = React.forwardRef<unknown, SliderSingleProps | SliderRangeProps>(
|
||||
|
||||
return wrapSSR(
|
||||
<RcSlider
|
||||
{...(restProps as SliderRangeProps)}
|
||||
step={restProps.step!}
|
||||
{...restProps}
|
||||
step={restProps.step}
|
||||
range={mergedRange}
|
||||
draggableTrack={draggableTrack}
|
||||
className={cls}
|
||||
@ -245,8 +243,7 @@ const Slider = React.forwardRef<unknown, SliderSingleProps | SliderRangeProps>(
|
||||
handleRender={handleRender}
|
||||
/>,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Slider.displayName = 'Slider';
|
||||
|
Loading…
Reference in New Issue
Block a user