[Refactoring] Use React.ReactNode instead of any for children

This commit is contained in:
Alexander Zinchuk 2022-02-25 22:52:23 +02:00
parent 8b60cef7c2
commit bd5f280e29
21 changed files with 23 additions and 23 deletions

View File

@ -8,7 +8,7 @@ import Link from '../ui/Link';
type OwnProps = {
className?: string;
chatId?: string;
children: any;
children: React.ReactNode;
};
const ChatLink: FC<OwnProps> = ({

View File

@ -10,7 +10,7 @@ import { getDispatch } from '../../lib/teact/teactn';
type OwnProps = {
className?: string;
groupCall?: Partial<ApiGroupCall>;
children: any;
children: React.ReactNode;
};
const GroupCallLink: FC<OwnProps> = ({

View File

@ -10,7 +10,7 @@ import Link from '../ui/Link';
type OwnProps = {
className?: string;
message?: ApiMessage;
children: any;
children: React.ReactNode;
};
const MessageLink: FC<OwnProps> = ({

View File

@ -12,7 +12,7 @@ type OwnProps = {
url?: string;
text: string;
className?: string;
children?: any;
children?: React.ReactNode;
isRtl?: boolean;
};

View File

@ -23,7 +23,7 @@ import { selectIsRightColumnShown, selectTheme } from '../../modules/selectors';
type OwnProps = {
page: 'main' | 'authCode' | 'authPassword' | 'authPhoneNumber' | 'authQrCode';
children: any;
children: React.ReactNode;
};
type StateProps =

View File

@ -10,7 +10,7 @@ import { getDispatch } from '../../lib/teact/teactn';
type OwnProps = {
className?: string;
sender?: ApiUser | ApiChat;
children: any;
children: React.ReactNode;
};
const UserLink: FC<OwnProps> = ({

View File

@ -20,7 +20,7 @@ export interface IDragData {
}
export interface OwnProps {
children: any;
children: React.ReactNode;
className?: string;
noWrap: boolean;
canPan: boolean;

View File

@ -8,7 +8,7 @@ import { selectUser } from '../../../modules/selectors';
type OwnProps = {
userId?: string;
username?: string;
children: any;
children: React.ReactNode;
};
type StateProps = {

View File

@ -14,7 +14,7 @@ import './Button.scss';
export type OwnProps = {
ref?: RefObject<HTMLButtonElement | HTMLAnchorElement>;
type?: 'button' | 'submit' | 'reset';
children: any;
children: React.ReactNode;
size?: 'default' | 'smaller' | 'tiny';
color?: (
'primary' | 'secondary' | 'gray' | 'danger' | 'translucent' | 'translucent-white' | 'translucent-black' | 'dark'

View File

@ -19,7 +19,7 @@ type OwnProps = {
confirmHandler: () => void;
confirmIsDestructive?: boolean;
isButtonsInOneRow?: boolean;
children?: any;
children?: React.ReactNode;
};
const ConfirmDialog: FC<OwnProps> = ({

View File

@ -13,7 +13,7 @@ type OwnProps = {
forceOpen?: boolean;
onOpen?: NoneToVoidFunction;
onClose?: NoneToVoidFunction;
children: any;
children: React.ReactNode;
};
const DropdownMenu: FC<OwnProps> = ({

View File

@ -13,7 +13,7 @@ type OwnProps = {
ariaLabel?: ButtonProps['ariaLabel'];
disabled?: boolean;
onClick: () => void;
children: any;
children: React.ReactNode;
};
const FloatingActionButton: FC<OwnProps> = ({

View File

@ -25,7 +25,7 @@ type OwnProps = {
noScrollRestoreOnTop?: boolean;
noFastList?: boolean;
cacheBuster?: any;
children: any;
children: React.ReactNode;
};
const DEFAULT_LIST_SELECTOR = '.ListItem';

View File

@ -5,7 +5,7 @@ import buildClassName from '../../util/buildClassName';
import './Link.scss';
type OwnProps = {
children: any;
children: React.ReactNode;
className?: string;
isRtl?: boolean;
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;

View File

@ -30,7 +30,7 @@ interface OwnProps {
secondaryIcon?: string;
className?: string;
style?: string;
children: any;
children: React.ReactNode;
disabled?: boolean;
ripple?: boolean;
narrow?: boolean;

View File

@ -33,7 +33,7 @@ type OwnProps = {
onClose?: () => void;
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
children: any;
children: React.ReactNode;
};
const ANIMATION_DURATION = 200;

View File

@ -10,7 +10,7 @@ type OnClickHandler = (e: React.SyntheticEvent<HTMLDivElement | HTMLAnchorElemen
type OwnProps = {
icon?: string;
className?: string;
children: any;
children: React.ReactNode;
onClick?: OnClickHandler;
href?: string;
download?: string;

View File

@ -28,7 +28,7 @@ type OwnProps = {
header?: any;
hasCloseButton?: boolean;
noBackdrop?: boolean;
children: any;
children: React.ReactNode;
onClose: () => void;
onCloseAnimationEnd?: () => void;
onEnter?: () => void;

View File

@ -1,10 +1,10 @@
import { FC, useRef, useLayoutEffect } from '../../lib/teact/teact';
import { FC, useRef, useLayoutEffect, VirtualElement } from '../../lib/teact/teact';
import TeactDOM from '../../lib/teact/teact-dom';
type OwnProps = {
containerId?: string;
className?: string;
children: any;
children: React.ReactNode;
};
const Portal: FC<OwnProps> = ({ containerId, className, children }) => {
@ -32,7 +32,7 @@ const Portal: FC<OwnProps> = ({ containerId, className, children }) => {
};
}, [className, containerId]);
return TeactDOM.render(children, elementRef.current);
return TeactDOM.render(children as VirtualElement, elementRef.current);
};
export default Portal;

View File

@ -16,7 +16,7 @@ import './SearchInput.scss';
type OwnProps = {
ref?: RefObject<HTMLInputElement>;
children?: any;
children?: React.ReactNode;
parentContainerClassName?: string;
className?: string;
inputId?: string;

View File

@ -12,7 +12,7 @@ type OwnProps = {
hasArrow?: boolean;
placeholder?: string;
onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;
children: any;
children: React.ReactNode;
};
const Select: FC<OwnProps> = (props) => {