typescript: replace unknown & any with SliderRef (#42420)

pull/42429/head
lijianan 2 years ago committed by GitHub
parent 7183eab0a9
commit f1fda002a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save