diff --git a/packages/@uppy/react/src/DashboardModal.d.ts b/packages/@uppy/react/src/DashboardModal.d.ts index d1c71d127..8e9710e37 100644 --- a/packages/@uppy/react/src/DashboardModal.d.ts +++ b/packages/@uppy/react/src/DashboardModal.d.ts @@ -1,13 +1,23 @@ -import { DashboardProps } from './Dashboard' +import { Omit, ToUppyProps } from './CommonTypes' +import Dashboard = require('@uppy/dashboard') -export interface DashboardModalProps extends DashboardProps { +// This type is mapped into `DashboardModalProps` below so IntelliSense doesn't display this big mess of nested types +type DashboardModalPropsInner = { open?: boolean onRequestClose?: VoidFunction +} & Omit< + ToUppyProps, + // Remove the inline-only and force-overridden props + 'inline' | 'onRequestCloseModal' +> + +export type DashboardModalProps = { + [K in keyof DashboardModalPropsInner]: DashboardModalPropsInner[K] } /** - * React Component that renders a Dashboard for an Uppy instance in a Modal - * dialog. Visibility of the Modal is toggled using the `open` prop. + * React Component that renders a Dashboard for an Uppy instance. This component + * renders the Dashboard inline so you can put it anywhere you want. */ declare const DashboardModal: React.ComponentType export default DashboardModal diff --git a/packages/@uppy/react/types/index.test-d.tsx b/packages/@uppy/react/types/index.test-d.tsx index 32c22dc79..0f2827d83 100644 --- a/packages/@uppy/react/types/index.test-d.tsx +++ b/packages/@uppy/react/types/index.test-d.tsx @@ -18,6 +18,8 @@ function TestComponent() { // inline option should be removed from proptypes because it is always overridden // by the component expectError() +expectError() +expectError() { const el = ( @@ -38,3 +40,19 @@ expectError() /> ) } + +{ + const el = ( + { + alert('no') + }} + /> + ) + + // use onRequestClose instead. + expectError() +}