diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index dd6349af16..2c36b665ce 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -3,6 +3,7 @@ import { polyfill } from 'react-lifecycles-compat'; import RcUpload from 'rc-upload'; import classNames from 'classnames'; import uniqBy from 'lodash/uniqBy'; +import findIndex from 'lodash/findIndex'; import Dragger from './Dragger'; import UploadList from './UploadList'; import { @@ -73,7 +74,7 @@ class Upload extends React.Component { const nextFileList = this.state.fileList.concat(); - const fileIndex = nextFileList.findIndex(({ uid }) => uid === targetItem.uid); + const fileIndex = findIndex(nextFileList, ({ uid }: UploadFile) => uid === targetItem.uid); if (fileIndex === -1) { nextFileList.push(targetItem); } else { diff --git a/typings/custom-typings.d.ts b/typings/custom-typings.d.ts index 6d5fcdecb3..0f7caa0028 100644 --- a/typings/custom-typings.d.ts +++ b/typings/custom-typings.d.ts @@ -97,7 +97,9 @@ declare module 'lodash/padEnd'; declare module 'lodash/uniqBy'; -declare module "raf"; +declare module 'lodash/findIndex'; + +declare module 'raf'; declare module 'react-lifecycles-compat';