type: replace any type with CheckboxRef (#43599)

This commit is contained in:
lijianan 2023-07-17 12:40:52 +08:00 committed by GitHub
parent 7222839178
commit d178eee50a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import type { CheckboxRef } from '../checkbox';
import type { AbstractCheckboxProps } from '../checkbox/Checkbox';
import { ConfigContext } from '../config-provider';
import { RadioOptionTypeContextProvider } from './context';
@ -7,17 +8,17 @@ import Radio from './radio';
export type RadioButtonProps = AbstractCheckboxProps<RadioChangeEvent>;
const RadioButton = (props: RadioButtonProps, ref: React.Ref<any>) => {
const RadioButton: React.ForwardRefRenderFunction<CheckboxRef, RadioButtonProps> = (props, ref) => {
const { getPrefixCls } = React.useContext(ConfigContext);
const { prefixCls: customizePrefixCls, ...radioProps } = props;
const prefixCls = getPrefixCls('radio', customizePrefixCls);
return (
<RadioOptionTypeContextProvider value="button">
<Radio prefixCls={prefixCls} {...radioProps} type="radio" ref={ref} />
<RadioOptionTypeContextProvider value='button'>
<Radio prefixCls={prefixCls} {...radioProps} type='radio' ref={ref} />
</RadioOptionTypeContextProvider>
);
};
export default React.forwardRef(RadioButton);
export default React.forwardRef<CheckboxRef, RadioButtonProps>(RadioButton);