[Refactoring] Use React.ReactNode instead of any for children
This commit is contained in:
parent
8b60cef7c2
commit
bd5f280e29
@ -8,7 +8,7 @@ import Link from '../ui/Link';
|
||||
type OwnProps = {
|
||||
className?: string;
|
||||
chatId?: string;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const ChatLink: FC<OwnProps> = ({
|
||||
|
||||
@ -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> = ({
|
||||
|
||||
@ -10,7 +10,7 @@ import Link from '../ui/Link';
|
||||
type OwnProps = {
|
||||
className?: string;
|
||||
message?: ApiMessage;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const MessageLink: FC<OwnProps> = ({
|
||||
|
||||
@ -12,7 +12,7 @@ type OwnProps = {
|
||||
url?: string;
|
||||
text: string;
|
||||
className?: string;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
isRtl?: boolean;
|
||||
};
|
||||
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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> = ({
|
||||
|
||||
@ -20,7 +20,7 @@ export interface IDragData {
|
||||
}
|
||||
|
||||
export interface OwnProps {
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
noWrap: boolean;
|
||||
canPan: boolean;
|
||||
|
||||
@ -8,7 +8,7 @@ import { selectUser } from '../../../modules/selectors';
|
||||
type OwnProps = {
|
||||
userId?: string;
|
||||
username?: string;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
type StateProps = {
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -19,7 +19,7 @@ type OwnProps = {
|
||||
confirmHandler: () => void;
|
||||
confirmIsDestructive?: boolean;
|
||||
isButtonsInOneRow?: boolean;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
const ConfirmDialog: FC<OwnProps> = ({
|
||||
|
||||
@ -13,7 +13,7 @@ type OwnProps = {
|
||||
forceOpen?: boolean;
|
||||
onOpen?: NoneToVoidFunction;
|
||||
onClose?: NoneToVoidFunction;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const DropdownMenu: FC<OwnProps> = ({
|
||||
|
||||
@ -13,7 +13,7 @@ type OwnProps = {
|
||||
ariaLabel?: ButtonProps['ariaLabel'];
|
||||
disabled?: boolean;
|
||||
onClick: () => void;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const FloatingActionButton: FC<OwnProps> = ({
|
||||
|
||||
@ -25,7 +25,7 @@ type OwnProps = {
|
||||
noScrollRestoreOnTop?: boolean;
|
||||
noFastList?: boolean;
|
||||
cacheBuster?: any;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const DEFAULT_LIST_SELECTOR = '.ListItem';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -30,7 +30,7 @@ interface OwnProps {
|
||||
secondaryIcon?: string;
|
||||
className?: string;
|
||||
style?: string;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
ripple?: boolean;
|
||||
narrow?: boolean;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -28,7 +28,7 @@ type OwnProps = {
|
||||
header?: any;
|
||||
hasCloseButton?: boolean;
|
||||
noBackdrop?: boolean;
|
||||
children: any;
|
||||
children: React.ReactNode;
|
||||
onClose: () => void;
|
||||
onCloseAnimationEnd?: () => void;
|
||||
onEnter?: () => void;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -16,7 +16,7 @@ import './SearchInput.scss';
|
||||
|
||||
type OwnProps = {
|
||||
ref?: RefObject<HTMLInputElement>;
|
||||
children?: any;
|
||||
children?: React.ReactNode;
|
||||
parentContainerClassName?: string;
|
||||
className?: string;
|
||||
inputId?: string;
|
||||
|
||||
@ -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) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user