[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 = {
|
type OwnProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
chatId?: string;
|
chatId?: string;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ChatLink: FC<OwnProps> = ({
|
const ChatLink: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { getDispatch } from '../../lib/teact/teactn';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
groupCall?: Partial<ApiGroupCall>;
|
groupCall?: Partial<ApiGroupCall>;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const GroupCallLink: FC<OwnProps> = ({
|
const GroupCallLink: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import Link from '../ui/Link';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
message?: ApiMessage;
|
message?: ApiMessage;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MessageLink: FC<OwnProps> = ({
|
const MessageLink: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -12,7 +12,7 @@ type OwnProps = {
|
|||||||
url?: string;
|
url?: string;
|
||||||
text: string;
|
text: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
children?: any;
|
children?: React.ReactNode;
|
||||||
isRtl?: boolean;
|
isRtl?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import { selectIsRightColumnShown, selectTheme } from '../../modules/selectors';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
page: 'main' | 'authCode' | 'authPassword' | 'authPhoneNumber' | 'authQrCode';
|
page: 'main' | 'authCode' | 'authPassword' | 'authPhoneNumber' | 'authQrCode';
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps =
|
type StateProps =
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { getDispatch } from '../../lib/teact/teactn';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
sender?: ApiUser | ApiChat;
|
sender?: ApiUser | ApiChat;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const UserLink: FC<OwnProps> = ({
|
const UserLink: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export interface IDragData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OwnProps {
|
export interface OwnProps {
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
noWrap: boolean;
|
noWrap: boolean;
|
||||||
canPan: boolean;
|
canPan: boolean;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { selectUser } from '../../../modules/selectors';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
userId?: string;
|
userId?: string;
|
||||||
username?: string;
|
username?: string;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import './Button.scss';
|
|||||||
export type OwnProps = {
|
export type OwnProps = {
|
||||||
ref?: RefObject<HTMLButtonElement | HTMLAnchorElement>;
|
ref?: RefObject<HTMLButtonElement | HTMLAnchorElement>;
|
||||||
type?: 'button' | 'submit' | 'reset';
|
type?: 'button' | 'submit' | 'reset';
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
size?: 'default' | 'smaller' | 'tiny';
|
size?: 'default' | 'smaller' | 'tiny';
|
||||||
color?: (
|
color?: (
|
||||||
'primary' | 'secondary' | 'gray' | 'danger' | 'translucent' | 'translucent-white' | 'translucent-black' | 'dark'
|
'primary' | 'secondary' | 'gray' | 'danger' | 'translucent' | 'translucent-white' | 'translucent-black' | 'dark'
|
||||||
|
|||||||
@ -19,7 +19,7 @@ type OwnProps = {
|
|||||||
confirmHandler: () => void;
|
confirmHandler: () => void;
|
||||||
confirmIsDestructive?: boolean;
|
confirmIsDestructive?: boolean;
|
||||||
isButtonsInOneRow?: boolean;
|
isButtonsInOneRow?: boolean;
|
||||||
children?: any;
|
children?: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ConfirmDialog: FC<OwnProps> = ({
|
const ConfirmDialog: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -13,7 +13,7 @@ type OwnProps = {
|
|||||||
forceOpen?: boolean;
|
forceOpen?: boolean;
|
||||||
onOpen?: NoneToVoidFunction;
|
onOpen?: NoneToVoidFunction;
|
||||||
onClose?: NoneToVoidFunction;
|
onClose?: NoneToVoidFunction;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DropdownMenu: FC<OwnProps> = ({
|
const DropdownMenu: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -13,7 +13,7 @@ type OwnProps = {
|
|||||||
ariaLabel?: ButtonProps['ariaLabel'];
|
ariaLabel?: ButtonProps['ariaLabel'];
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FloatingActionButton: FC<OwnProps> = ({
|
const FloatingActionButton: FC<OwnProps> = ({
|
||||||
|
|||||||
@ -25,7 +25,7 @@ type OwnProps = {
|
|||||||
noScrollRestoreOnTop?: boolean;
|
noScrollRestoreOnTop?: boolean;
|
||||||
noFastList?: boolean;
|
noFastList?: boolean;
|
||||||
cacheBuster?: any;
|
cacheBuster?: any;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_LIST_SELECTOR = '.ListItem';
|
const DEFAULT_LIST_SELECTOR = '.ListItem';
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import buildClassName from '../../util/buildClassName';
|
|||||||
import './Link.scss';
|
import './Link.scss';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
isRtl?: boolean;
|
isRtl?: boolean;
|
||||||
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ interface OwnProps {
|
|||||||
secondaryIcon?: string;
|
secondaryIcon?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
style?: string;
|
style?: string;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
ripple?: boolean;
|
ripple?: boolean;
|
||||||
narrow?: boolean;
|
narrow?: boolean;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ type OwnProps = {
|
|||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
||||||
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ANIMATION_DURATION = 200;
|
const ANIMATION_DURATION = 200;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ type OnClickHandler = (e: React.SyntheticEvent<HTMLDivElement | HTMLAnchorElemen
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
icon?: string;
|
icon?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
onClick?: OnClickHandler;
|
onClick?: OnClickHandler;
|
||||||
href?: string;
|
href?: string;
|
||||||
download?: string;
|
download?: string;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ type OwnProps = {
|
|||||||
header?: any;
|
header?: any;
|
||||||
hasCloseButton?: boolean;
|
hasCloseButton?: boolean;
|
||||||
noBackdrop?: boolean;
|
noBackdrop?: boolean;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onCloseAnimationEnd?: () => void;
|
onCloseAnimationEnd?: () => void;
|
||||||
onEnter?: () => 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';
|
import TeactDOM from '../../lib/teact/teact-dom';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
containerId?: string;
|
containerId?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Portal: FC<OwnProps> = ({ containerId, className, children }) => {
|
const Portal: FC<OwnProps> = ({ containerId, className, children }) => {
|
||||||
@ -32,7 +32,7 @@ const Portal: FC<OwnProps> = ({ containerId, className, children }) => {
|
|||||||
};
|
};
|
||||||
}, [className, containerId]);
|
}, [className, containerId]);
|
||||||
|
|
||||||
return TeactDOM.render(children, elementRef.current);
|
return TeactDOM.render(children as VirtualElement, elementRef.current);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Portal;
|
export default Portal;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import './SearchInput.scss';
|
|||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
ref?: RefObject<HTMLInputElement>;
|
ref?: RefObject<HTMLInputElement>;
|
||||||
children?: any;
|
children?: React.ReactNode;
|
||||||
parentContainerClassName?: string;
|
parentContainerClassName?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
inputId?: string;
|
inputId?: string;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ type OwnProps = {
|
|||||||
hasArrow?: boolean;
|
hasArrow?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;
|
onChange?: (e: ChangeEvent<HTMLSelectElement>) => void;
|
||||||
children: any;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Select: FC<OwnProps> = (props) => {
|
const Select: FC<OwnProps> = (props) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user