fix: deps and TypeScript types (#31519)

* fix tsc errors

* fix tsc errors
This commit is contained in:
afc163 2021-07-26 16:47:55 +08:00 committed by GitHub
parent c7e0cda393
commit a9a329d37c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 42 deletions

View File

@ -62,11 +62,13 @@ const Collapse: CollapseInterface = props => {
const renderExpandIcon = (panelProps: PanelProps = {}) => { const renderExpandIcon = (panelProps: PanelProps = {}) => {
const { expandIcon } = props; const { expandIcon } = props;
const icon = (expandIcon ? ( const icon = (
expandIcon(panelProps) expandIcon ? (
) : ( expandIcon(panelProps)
<RightOutlined rotate={panelProps.isActive ? 90 : undefined} /> ) : (
)) as React.ReactNode; <RightOutlined rotate={panelProps.isActive ? 90 : undefined} />
)
) as React.ReactNode;
return cloneElement(icon, () => ({ return cloneElement(icon, () => ({
className: classNames((icon as any).props.className, `${prefixCls}-arrow`), className: classNames((icon as any).props.className, `${prefixCls}-arrow`),
@ -110,7 +112,6 @@ const Collapse: CollapseInterface = props => {
<RcCollapse <RcCollapse
openMotion={openMotion} openMotion={openMotion}
{...props} {...props}
bordered={bordered}
expandIcon={renderExpandIcon} expandIcon={renderExpandIcon}
prefixCls={prefixCls} prefixCls={prefixCls}
className={collapseClassName} className={collapseClassName}

View File

@ -72,7 +72,7 @@ export interface ModalProps {
maskTransitionName?: string; maskTransitionName?: string;
transitionName?: string; transitionName?: string;
className?: string; className?: string;
getContainer?: string | HTMLElement | getContainerFunc | false | null; getContainer?: string | HTMLElement | getContainerFunc | false;
zIndex?: number; zIndex?: number;
bodyStyle?: React.CSSProperties; bodyStyle?: React.CSSProperties;
maskStyle?: React.CSSProperties; maskStyle?: React.CSSProperties;
@ -114,7 +114,7 @@ export interface ModalFuncProps {
maskStyle?: React.CSSProperties; maskStyle?: React.CSSProperties;
type?: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm'; type?: 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm';
keyboard?: boolean; keyboard?: boolean;
getContainer?: string | HTMLElement | getContainerFunc | false | null; getContainer?: string | HTMLElement | getContainerFunc | false;
autoFocusButton?: null | 'ok' | 'cancel'; autoFocusButton?: null | 'ok' | 'cancel';
transitionName?: string; transitionName?: string;
maskTransitionName?: string; maskTransitionName?: string;
@ -136,9 +136,11 @@ interface ModalInterface extends React.FC<ModalProps> {
} }
const Modal: ModalInterface = props => { const Modal: ModalInterface = props => {
const { getPopupContainer: getContextPopupContainer, getPrefixCls, direction } = React.useContext( const {
ConfigContext, getPopupContainer: getContextPopupContainer,
); getPrefixCls,
direction,
} = React.useContext(ConfigContext);
const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => { const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {
const { onCancel } = props; const { onCancel } = props;
@ -203,7 +205,9 @@ const Modal: ModalInterface = props => {
return ( return (
<Dialog <Dialog
{...restProps} {...restProps}
getContainer={getContainer === undefined ? getContextPopupContainer : getContainer} getContainer={
getContainer === undefined ? (getContextPopupContainer as getContainerFunc) : getContainer
}
prefixCls={prefixCls} prefixCls={prefixCls}
wrapClassName={wrapClassNameExtended} wrapClassName={wrapClassNameExtended}
footer={footer === undefined ? defaultFooter : footer} footer={footer === undefined ? defaultFooter : footer}

View File

@ -1,6 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import omit from 'rc-util/lib/omit'; import omit from 'rc-util/lib/omit';
import RcSteps from 'rc-steps'; import RcSteps from 'rc-steps';
import type { ProgressDotRender } from 'rc-steps/lib/Steps';
import CheckOutlined from '@ant-design/icons/CheckOutlined'; import CheckOutlined from '@ant-design/icons/CheckOutlined';
import CloseOutlined from '@ant-design/icons/CloseOutlined'; import CloseOutlined from '@ant-design/icons/CloseOutlined';
import classNames from 'classnames'; import classNames from 'classnames';
@ -17,7 +18,7 @@ export interface StepsProps {
initial?: number; initial?: number;
labelPlacement?: 'horizontal' | 'vertical'; labelPlacement?: 'horizontal' | 'vertical';
prefixCls?: string; prefixCls?: string;
progressDot?: boolean | Function; progressDot?: boolean | ProgressDotRender;
responsive?: boolean; responsive?: boolean;
size?: 'default' | 'small'; size?: 'default' | 'small';
status?: 'wait' | 'process' | 'finish' | 'error'; status?: 'wait' | 'process' | 'finish' | 'error';
@ -39,7 +40,7 @@ export interface StepProps {
} }
interface StepsType extends React.FC<StepsProps> { interface StepsType extends React.FC<StepsProps> {
Step: React.ClassicComponentClass<StepProps>; Step: typeof RcSteps.Step;
} }
const Steps: StepsType = props => { const Steps: StepsType = props => {
@ -47,10 +48,10 @@ const Steps: StepsType = props => {
const { xs } = useBreakpoint(); const { xs } = useBreakpoint();
const { getPrefixCls, direction: rtlDirection } = React.useContext(ConfigContext); const { getPrefixCls, direction: rtlDirection } = React.useContext(ConfigContext);
const getDirection = React.useCallback(() => (responsive && xs ? 'vertical' : direction), [ const getDirection = React.useCallback(
xs, () => (responsive && xs ? 'vertical' : direction),
direction, [xs, direction],
]); );
const prefixCls = getPrefixCls('steps', props.prefixCls); const prefixCls = getPrefixCls('steps', props.prefixCls);
const iconPrefix = getPrefixCls('', props.iconPrefix); const iconPrefix = getPrefixCls('', props.iconPrefix);

View File

@ -59,7 +59,7 @@ const DirectoryTree: React.ForwardRefRenderFunction<RcTree, DirectoryTreeProps>
initExpandedKeys = Object.keys(keyEntities); initExpandedKeys = Object.keys(keyEntities);
} else if (defaultExpandParent) { } else if (defaultExpandParent) {
initExpandedKeys = conductExpandParent( initExpandedKeys = conductExpandParent(
props.expandedKeys || defaultExpandedKeys, props.expandedKeys || defaultExpandedKeys || [],
keyEntities, keyEntities,
); );
} else { } else {

View File

@ -120,7 +120,7 @@
"rc-cascader": "~1.4.0", "rc-cascader": "~1.4.0",
"rc-checkbox": "~2.3.0", "rc-checkbox": "~2.3.0",
"rc-collapse": "~3.1.0", "rc-collapse": "~3.1.0",
"rc-dialog": "~8.5.1", "rc-dialog": "~8.6.0",
"rc-drawer": "~4.3.0", "rc-drawer": "~4.3.0",
"rc-dropdown": "~3.2.0", "rc-dropdown": "~3.2.0",
"rc-field-form": "~1.20.0", "rc-field-form": "~1.20.0",
@ -236,8 +236,6 @@
"pretty-quick": "^3.0.0", "pretty-quick": "^3.0.0",
"querystring": "^0.2.0", "querystring": "^0.2.0",
"rc-footer": "^0.6.6", "rc-footer": "^0.6.6",
"rc-queue-anim": "^1.6.12",
"rc-scroll-anim": "^2.5.8",
"rc-tween-one": "^2.4.1", "rc-tween-one": "^2.4.1",
"rc-virtual-list": "^3.2.4", "rc-virtual-list": "^3.2.4",
"react": "^17.0.1", "react": "^17.0.1",

View File

@ -18,32 +18,12 @@ declare module 'jsonml.js/*';
declare module 'rc-pagination/*'; declare module 'rc-pagination/*';
declare module 'rc-animate*';
declare module 'rc-util*'; declare module 'rc-util*';
declare module '@ant-design/css-animation*';
declare module 'rc-checkbox'; declare module 'rc-checkbox';
declare module 'rc-radio';
declare module 'rc-editor-mention';
declare module 'rc-tabs*';
declare module 'rc-tree/lib/util';
declare module 'rc-collapse';
declare module 'rc-dialog';
declare module 'rc-rate'; declare module 'rc-rate';
declare module 'rc-queue-anim';
declare module 'rc-steps';
declare module 'rc-switch'; declare module 'rc-switch';
declare module '*.json' { declare module '*.json' {