Browse Source

fix: deps and TypeScript types (#31519)

* fix tsc errors

* fix tsc errors
pull/31533/head
afc163 3 years ago
committed by GitHub
parent
commit
a9a329d37c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      components/collapse/Collapse.tsx
  2. 16
      components/modal/Modal.tsx
  3. 13
      components/steps/index.tsx
  4. 2
      components/tree/DirectoryTree.tsx
  5. 4
      package.json
  6. 20
      typings/custom-typings.d.ts

13
components/collapse/Collapse.tsx

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

16
components/modal/Modal.tsx

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

13
components/steps/index.tsx

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

2
components/tree/DirectoryTree.tsx

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

4
package.json

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

20
typings/custom-typings.d.ts

@ -18,32 +18,12 @@ declare module 'jsonml.js/*';
declare module 'rc-pagination/*';
declare module 'rc-animate*';
declare module 'rc-util*';
declare module '@ant-design/css-animation*';
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-queue-anim';
declare module 'rc-steps';
declare module 'rc-switch';
declare module '*.json' {

Loading…
Cancel
Save