Browse Source

Merge pull request #1131 from mattes3/master

Make Uppy's React components usable from Typescript
Renée Kooi 6 years ago
parent
commit
1a0878a851
33 changed files with 422 additions and 206 deletions
  1. 22 0
      package-lock.json
  2. 1 0
      package.json
  3. 21 17
      packages/@uppy/aws-s3-multipart/types/index.d.ts
  4. 18 14
      packages/@uppy/aws-s3/types/index.d.ts
  5. 1 1
      packages/@uppy/core/types/index.d.ts
  6. 27 23
      packages/@uppy/dashboard/types/index.d.ts
  7. 13 9
      packages/@uppy/drag-drop/types/index.d.ts
  8. 10 6
      packages/@uppy/dropbox/types/index.d.ts
  9. 10 6
      packages/@uppy/file-input/types/index.d.ts
  10. 13 9
      packages/@uppy/form/types/index.d.ts
  11. 11 7
      packages/@uppy/golden-retriever/types/index.d.ts
  12. 10 6
      packages/@uppy/google-drive/types/index.d.ts
  13. 15 11
      packages/@uppy/informer/types/index.d.ts
  14. 10 6
      packages/@uppy/instagram/types/index.d.ts
  15. 10 6
      packages/@uppy/progress-bar/types/index.d.ts
  16. 6 0
      packages/@uppy/react/src/CommonTypes.d.ts
  17. 33 0
      packages/@uppy/react/src/Dashboard.d.ts
  18. 16 0
      packages/@uppy/react/src/DashboardModal.d.ts
  19. 13 0
      packages/@uppy/react/src/DragDrop.d.ts
  20. 13 0
      packages/@uppy/react/src/ProgressBar.d.ts
  21. 14 0
      packages/@uppy/react/src/StatusBar.d.ts
  22. 7 0
      packages/@uppy/react/types/index.d.ts
  23. 8 4
      packages/@uppy/redux-dev-tools/types/index.d.ts
  24. 11 7
      packages/@uppy/status-bar/types/index.d.ts
  25. 2 1
      packages/@uppy/store-default/types/index.d.ts
  26. 8 1
      packages/@uppy/store-redux/types/index.d.ts
  27. 9 5
      packages/@uppy/thumbnail-generator/types/index.d.ts
  28. 28 24
      packages/@uppy/transloadit/types/index.d.ts
  29. 14 10
      packages/@uppy/tus/types/index.d.ts
  30. 10 6
      packages/@uppy/url/types/index.d.ts
  31. 17 12
      packages/@uppy/webcam/types/index.d.ts
  32. 18 14
      packages/@uppy/xhr-upload/types/index.d.ts
  33. 3 1
      packages/uppy/types/index.d.ts

+ 22 - 0
package-lock.json

@@ -1683,11 +1683,27 @@
 			"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.37.tgz",
 			"integrity": "sha512-Jp39foY8Euv/PG4OGPyzxis82mnjcUtXLEMA8oFMCE4ilmuJgZPdV2nZNV1moz+99EJTtcpOSgDCgATUwABKig=="
 		},
+		"@types/prop-types": {
+			"version": "15.5.6",
+			"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.6.tgz",
+			"integrity": "sha512-ZBFR7TROLVzCkswA3Fmqq+IIJt62/T7aY/Dmz+QkU7CaW2QFqAitCE8Ups7IzmGhcN1YWMBT4Qcoc07jU9hOJQ==",
+			"dev": true
+		},
 		"@types/range-parser": {
 			"version": "1.2.2",
 			"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.2.tgz",
 			"integrity": "sha512-HtKGu+qG1NPvYe1z7ezLsyIaXYyi8SoAVqWDZgDQ8dLrsZvSzUNCwZyfX33uhWxL/SU0ZDQZ3nwZ0nimt507Kw=="
 		},
+		"@types/react": {
+			"version": "16.4.18",
+			"resolved": "https://registry.npmjs.org/@types/react/-/react-16.4.18.tgz",
+			"integrity": "sha512-eFzJKEg6pdeaukVLVZ8Xb79CTl/ysX+ExmOfAAqcFlCCK5TgFDD9kWR0S18sglQ3EmM8U+80enjUqbfnUyqpdA==",
+			"dev": true,
+			"requires": {
+				"@types/prop-types": "*",
+				"csstype": "^2.2.0"
+			}
+		},
 		"@types/redis": {
 			"version": "2.8.8",
 			"resolved": "https://registry.npmjs.org/@types/redis/-/redis-2.8.8.tgz",
@@ -7173,6 +7189,12 @@
 				"cssom": "0.3.x"
 			}
 		},
+		"csstype": {
+			"version": "2.5.7",
+			"resolved": "https://registry.npmjs.org/csstype/-/csstype-2.5.7.tgz",
+			"integrity": "sha512-Nt5VDyOTIIV4/nRFswoCKps1R5CD1hkiyjBE9/thNaNZILLEviVw9yWQw15+O+CpNjQKB/uvdcxFFOrSflY3Yw==",
+			"dev": true
+		},
 		"cuid": {
 			"version": "2.1.4",
 			"resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.4.tgz",

+ 1 - 0
package.json

@@ -9,6 +9,7 @@
   "pre-commit": "lint-staged",
   "license": "MIT",
   "devDependencies": {
+    "@types/react": "^16.4.18",
     "aliasify": "^2.1.0",
     "autoprefixer": "^7.2.6",
     "babel-cli": "^6.26.0",

+ 21 - 17
packages/@uppy/aws-s3-multipart/types/index.d.ts

@@ -1,28 +1,32 @@
 import { Plugin, PluginOptions, Uppy, UppyFile } from '@uppy/core';
 
-export interface AwsS3Part {
-  PartNumber: number;
-  Size: number;
-  ETag: string;
-}
+declare module AwsS3Multipart {
+  interface AwsS3Part {
+    PartNumber?: number;
+    Size?: number;
+    ETag?: string;
+  }
 
-export interface AwsS3MultipartOptions extends PluginOptions {
-  serverUrl: string;
-  createMultipartUpload(file: UppyFile): Promise<{uploadId: string, key: string}>;
-  listParts(file: UppyFile, opts: {uploadId: string, key: string}): Promise<AwsS3Part>;
-  prepareUploadPart(file: UppyFile, partData: {uploadId: string, key: string, body: Blob, number: number}): Promise<{url: string}>;
-  abortMultipartUpload(file: UppyFile, opts: {uploadId: string, key: string}): Promise<void>;
-  completeMultipartUpload(file: UppyFile, opts: {uploadId: string, key: string, parts: AwsS3Part[]}): Promise<{location?: string}>;
-  timeout: number;
-  limit: number;
+  interface AwsS3MultipartOptions extends PluginOptions {
+    serverUrl: string;
+    createMultipartUpload(file: UppyFile): Promise<{ uploadId: string, key: string }>;
+    listParts(file: UppyFile, opts: { uploadId: string, key: string }): Promise<AwsS3Part[]>;
+    prepareUploadPart(file: UppyFile, partData: { uploadId: string, key: string, body: Blob, number: number }): Promise<{ url: string }>;
+    abortMultipartUpload(file: UppyFile, opts: { uploadId: string, key: string }): Promise<void>;
+    completeMultipartUpload(file: UppyFile, opts: { uploadId: string, key: string, parts: AwsS3Part[] }): Promise<{ location?: string }>;
+    timeout: number;
+    limit: number;
+  }
 }
 
-export default class AwsS3Multipart extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<AwsS3MultipartOptions>);
+declare class AwsS3Multipart extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<AwsS3Multipart.AwsS3MultipartOptions>);
 }
 
+export = AwsS3Multipart;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof AwsS3Multipart, opts: Partial<AwsS3MultipartOptions>): Uppy;
+    use(pluginClass: typeof AwsS3Multipart, opts: Partial<AwsS3Multipart.AwsS3MultipartOptions>): Uppy;
   }
 }

+ 18 - 14
packages/@uppy/aws-s3/types/index.d.ts

@@ -1,25 +1,29 @@
 import { Plugin, PluginOptions, Uppy, UppyFile } from '@uppy/core';
 
-export interface AwsS3UploadParameters {
-  method?: string;
-  url: string;
-  fields?: { [type: string]: string };
-  headers?: { [type: string]: string };
-}
+declare module AwsS3 {
+  interface AwsS3UploadParameters {
+    method?: string;
+    url: string;
+    fields?: { [type: string]: string };
+    headers?: { [type: string]: string };
+  }
 
-export interface AwsS3Options extends PluginOptions {
-  serverUrl: string;
-  getUploadParameters(file: UppyFile): Promise<AwsS3UploadParameters>;
-  timeout: number;
-  limit: number;
+  interface AwsS3Options extends PluginOptions {
+    serverUrl: string;
+    getUploadParameters(file: UppyFile): Promise<AwsS3UploadParameters>;
+    timeout: number;
+    limit: number;
+  }
 }
 
-export default class AwsS3 extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<AwsS3Options>);
+declare class AwsS3 extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<AwsS3.AwsS3Options>);
 }
 
+export = AwsS3;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof AwsS3, opts: Partial<AwsS3Options>): Uppy;
+    use(pluginClass: typeof AwsS3, opts: Partial<AwsS3.AwsS3Options>): Uppy;
   }
 }

+ 1 - 1
packages/@uppy/core/types/index.d.ts

@@ -81,8 +81,8 @@ interface Locale {
 export interface UppyOptions {
   id: string;
   autoProceed: boolean;
+  allowMultipleUploads: boolean;
   debug: boolean;
-  showLinkToFileUploadResult: boolean;
   restrictions: {
     maxFileSize: number | null;
     maxNumberOfFiles: number | null;

+ 27 - 23
packages/@uppy/dashboard/types/index.d.ts

@@ -1,29 +1,31 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface DashboardOptions extends PluginOptions {
-  onRequestCloseModal: () => void;
-  disablePageScrollWhenModalOpen: boolean;
-  closeModalOnClickOutside: boolean;
-  trigger: string | HTMLElement;
-  inline: boolean;
-  defaultTabIcon: string;
-  hideUploadButton: boolean;
-  width: string | number;
-  height: string | number;
-  note: string;
-  showLinkToFileUploadResult: boolean;
-  proudlyDisplayPoweredByUppy: boolean;
-  metaFields: string[];
-  plugins: string[];
-  disableStatusBar: boolean;
-  showProgressDetails: boolean;
-  hideProgressAfterFinish: boolean;
-  disableInformer: boolean;
-  disableThumbnailGenerator: boolean;
+declare module Dashboard {
+  interface DashboardOptions extends PluginOptions {
+    onRequestCloseModal: () => void;
+    disablePageScrollWhenModalOpen: boolean;
+    closeModalOnClickOutside: boolean;
+    trigger: string | HTMLElement;
+    inline: boolean;
+    defaultTabIcon: string;
+    hideUploadButton: boolean;
+    width: string | number;
+    height: string | number;
+    note: string;
+    showLinkToFileUploadResult: boolean;
+    proudlyDisplayPoweredByUppy: boolean;
+    metaFields: string[];
+    plugins: string[];
+    disableStatusBar: boolean;
+    showProgressDetails: boolean;
+    hideProgressAfterFinish: boolean;
+    disableInformer: boolean;
+    disableThumbnailGenerator: boolean;
+  }
 }
 
-export default class Dashboard extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<DashboardOptions>);
+declare class Dashboard extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Dashboard.DashboardOptions>);
   addTarget(plugin: Plugin): HTMLElement;
   hideAllPanels(): void;
   openModal(): void;
@@ -34,8 +36,10 @@ export default class Dashboard extends Plugin {
   uninstall(): void;
 }
 
+export = Dashboard;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Dashboard, opts: Partial<DashboardOptions>): Uppy;
+    use(pluginClass: typeof Dashboard, opts: Partial<Dashboard.DashboardOptions>): Uppy;
   }
 }

+ 13 - 9
packages/@uppy/drag-drop/types/index.d.ts

@@ -1,19 +1,23 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface DragDropOptions extends PluginOptions {
-  inputName: string;
-  allowMultipleFiles: boolean;
-  width: string;
-  height: string;
-  note: string;
+declare module DragDrop {
+  interface DragDropOptions extends PluginOptions {
+    inputName: string;
+    allowMultipleFiles: boolean;
+    width: string;
+    height: string;
+    note: string;
+  }
 }
 
-export default class DragDrop extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<DragDropOptions>);
+declare class DragDrop extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<DragDrop.DragDropOptions>);
 }
 
+export = DragDrop;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof DragDrop, opts: Partial<DragDropOptions>): Uppy;
+    use(pluginClass: typeof DragDrop, opts: Partial<DragDrop.DragDropOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/dropbox/types/index.d.ts

@@ -1,17 +1,21 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 import { ProviderOptions } from '@uppy/companion-client';
 
-export interface DropboxOptions extends PluginOptions, ProviderOptions {
-  serverUrl: string;
-  serverPattern: string | RegExp | Array<string | RegExp>;
+declare module Dropbox {
+  interface DropboxOptions extends PluginOptions, ProviderOptions {
+    serverUrl: string;
+    serverPattern: string | RegExp | Array<string | RegExp>;
+  }
 }
 
-export default class Dropbox extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<DropboxOptions>);
+declare class Dropbox extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Dropbox.DropboxOptions>);
 }
 
+export = Dropbox;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Dropbox, opts: Partial<DropboxOptions>): Uppy;
+    use(pluginClass: typeof Dropbox, opts: Partial<Dropbox.DropboxOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/file-input/types/index.d.ts

@@ -1,16 +1,20 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface FileInputOptions extends PluginOptions {
-  pretty: boolean;
-  inputName: string;
+declare module FileInput {
+  interface FileInputOptions extends PluginOptions {
+    pretty: boolean;
+    inputName: string;
+  }
 }
 
-export default class FileInput extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<FileInputOptions>);
+declare class FileInput extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<FileInput.FileInputOptions>);
 }
 
+export = FileInput;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof FileInput, opts: Partial<FileInputOptions>): Uppy;
+    use(pluginClass: typeof FileInput, opts: Partial<FileInput.FileInputOptions>): Uppy;
   }
 }

+ 13 - 9
packages/@uppy/form/types/index.d.ts

@@ -1,19 +1,23 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface FormOptions extends PluginOptions {
-  getMetaFromForm: boolean;
-  addResultToForm: boolean;
-  submitOnSuccess: boolean;
-  triggerUploadOnSubmit: boolean;
-  resultName: string;
+declare module Form {
+  interface FormOptions extends PluginOptions {
+    getMetaFromForm: boolean;
+    addResultToForm: boolean;
+    submitOnSuccess: boolean;
+    triggerUploadOnSubmit: boolean;
+    resultName: string;
+  }
 }
 
-export default class Form extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<FormOptions>);
+declare class Form extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Form.FormOptions>);
 }
 
+export = Form;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Form, opts: Partial<FormOptions>): Uppy;
+    use(pluginClass: typeof Form, opts: Partial<Form.FormOptions>): Uppy;
   }
 }

+ 11 - 7
packages/@uppy/golden-retriever/types/index.d.ts

@@ -1,17 +1,21 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface GoldenRetrieverOptions extends PluginOptions {
-  expires: number;
-  serviceWorker: boolean;
-  indexedDB: any;
+declare module GoldenRetriever {
+  interface GoldenRetrieverOptions extends PluginOptions {
+    expires: number;
+    serviceWorker: boolean;
+    indexedDB: any;
+  }
 }
 
-export default class GoldenRetriever extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<GoldenRetrieverOptions>);
+declare class GoldenRetriever extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<GoldenRetriever.GoldenRetrieverOptions>);
 }
 
+export = GoldenRetriever;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof GoldenRetriever, opts: Partial<GoldenRetrieverOptions>): Uppy;
+    use(pluginClass: typeof GoldenRetriever, opts: Partial<GoldenRetriever.GoldenRetrieverOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/google-drive/types/index.d.ts

@@ -1,17 +1,21 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 import { ProviderOptions } from '@uppy/companion-client';
 
-export interface GoogleDriveOptions extends PluginOptions, ProviderOptions {
-  serverUrl: string;
-  serverPattern: string | RegExp | Array<string | RegExp>;
+declare module GoogleDrive {
+  interface GoogleDriveOptions extends PluginOptions, ProviderOptions {
+    serverUrl: string;
+    serverPattern: string | RegExp | Array<string | RegExp>;
+  }
 }
 
-export default class GoogleDrive extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<GoogleDriveOptions>);
+declare class GoogleDrive extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<GoogleDrive.GoogleDriveOptions>);
 }
 
+export = GoogleDrive;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof GoogleDrive, opts: Partial<GoogleDriveOptions>): Uppy;
+    use(pluginClass: typeof GoogleDrive, opts: Partial<GoogleDrive.GoogleDriveOptions>): Uppy;
   }
 }

+ 15 - 11
packages/@uppy/informer/types/index.d.ts

@@ -1,22 +1,26 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-interface Color {
-  bg: string | number;
-  text: string | number;
-}
+declare module Informer {
+  interface Color {
+    bg: string | number;
+    text: string | number;
+  }
 
-export interface InformerOptions extends PluginOptions {
-  typeColors: {
-    [type: string]: Color
-  };
+  interface InformerOptions extends PluginOptions {
+    typeColors: {
+      [type: string]: Color
+    };
+  }
 }
 
-export default class Informer extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<InformerOptions>);
+declare class Informer extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Informer.InformerOptions>);
 }
 
+export = Informer;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Informer, opts: Partial<InformerOptions>): Uppy;
+    use(pluginClass: typeof Informer, opts: Partial<Informer.InformerOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/instagram/types/index.d.ts

@@ -1,17 +1,21 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 import { ProviderOptions } from '@uppy/companion-client';
 
-export interface InstagramOptions extends PluginOptions, ProviderOptions {
-  serverUrl: string;
-  serverPattern: string | RegExp | Array<string | RegExp>;
+declare module Instagram {
+  interface InstagramOptions extends PluginOptions, ProviderOptions {
+    serverUrl: string;
+    serverPattern: string | RegExp | Array<string | RegExp>;
+  }
 }
 
-export default class Instagram extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<InstagramOptions>);
+declare class Instagram extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Instagram.InstagramOptions>);
 }
 
+export = Instagram;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Instagram, opts: Partial<InstagramOptions>): Uppy;
+    use(pluginClass: typeof Instagram, opts: Partial<Instagram.InstagramOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/progress-bar/types/index.d.ts

@@ -1,16 +1,20 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface ProgressBarOptions extends PluginOptions {
-  hideAfterFinish: boolean;
-  fixed: boolean;
+declare module ProgressBar {
+  interface ProgressBarOptions extends PluginOptions {
+    hideAfterFinish: boolean;
+    fixed: boolean;
+  }
 }
 
-export default class ProgressBar extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<ProgressBarOptions>);
+declare class ProgressBar extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<ProgressBar.ProgressBarOptions>);
 }
 
+export = ProgressBar;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof ProgressBar, opts: Partial<ProgressBarOptions>): Uppy;
+    use(pluginClass: typeof ProgressBar, opts: Partial<ProgressBar.ProgressBarOptions>): Uppy;
   }
 }

+ 6 - 0
packages/@uppy/react/src/CommonTypes.d.ts

@@ -0,0 +1,6 @@
+export { Uppy } from '../../core/types';
+
+export interface Locale {
+    strings: { [index: string]: string };
+    pluralize: (noun: string) => string;
+}

+ 33 - 0
packages/@uppy/react/src/Dashboard.d.ts

@@ -0,0 +1,33 @@
+import { Uppy, Locale } from './CommonTypes';
+
+interface MetaField {
+    id: string;
+    name: string;
+    placeholder?: string;
+}
+
+export interface DashboardProps {
+    uppy: Uppy;
+    inline?: boolean;
+    plugins?: Array<string>;
+    width?: number;
+    height?: number;
+    showProgressDetails?: boolean;
+    showLinkToFileUploadResult?: boolean;
+    hideUploadButton?: boolean;
+    hideProgressAfterFinish?: boolean;
+    note?: string;
+    metaFields?: Array<MetaField>;
+    proudlyDisplayPoweredByUppy?: boolean;
+    disableStatusBar?: boolean;
+    disableInformer?: boolean;
+    disableThumbnailGenerator?: boolean;
+    locale?: Locale;
+}
+
+/**
+ * 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 Dashboard: React.ComponentType<DashboardProps>;
+export default Dashboard;

+ 16 - 0
packages/@uppy/react/src/DashboardModal.d.ts

@@ -0,0 +1,16 @@
+import { DashboardProps } from './Dashboard';
+
+export interface DashboardModalProps extends DashboardProps {
+    target?: HTMLElement;
+    open?: boolean;
+    onRequestClose?: VoidFunction;
+    closeModalOnClickOutside?: boolean;
+    disablePageScrollWhenModalOpen?: boolean;
+}
+
+/**
+ * React Component that renders a Dashboard for an Uppy instance in a Modal
+ * dialog. Visibility of the Modal is toggled using the `open` prop.
+ */
+declare const DashboardModal: React.ComponentType<DashboardModalProps>;
+export default DashboardModal;

+ 13 - 0
packages/@uppy/react/src/DragDrop.d.ts

@@ -0,0 +1,13 @@
+import { Uppy, Locale } from './CommonTypes';
+
+export interface DragDropProps {
+    uppy: Uppy;
+    locale?: Locale;
+}
+
+/**
+ * React component that renders an area in which files can be dropped to be
+ * uploaded.
+ */
+declare const DragDrop: React.ComponentType<DragDropProps>;
+export default DragDrop;

+ 13 - 0
packages/@uppy/react/src/ProgressBar.d.ts

@@ -0,0 +1,13 @@
+import { Uppy } from './CommonTypes';
+
+export interface ProgressBarProps {
+    uppy: Uppy;
+    fixed?: boolean;
+    hideAfterFinish?: boolean;
+}
+
+/**
+ * React component that renders a progress bar at the top of the page.
+ */
+declare const ProgressBar: React.ComponentType<ProgressBarProps>;
+export default ProgressBar;

+ 14 - 0
packages/@uppy/react/src/StatusBar.d.ts

@@ -0,0 +1,14 @@
+import { Uppy } from './CommonTypes';
+
+export interface StatusBarProps {
+    uppy: Uppy;
+    showProgressDetails?: boolean;
+    hideAfterFinish?: boolean;
+}
+
+/**
+ * React component that renders a status bar containing upload progress and speed,
+ * processing progress and pause/resume/cancel controls.
+ */
+declare const StatusBar: React.ComponentType<StatusBarProps>;
+export default StatusBar;

+ 7 - 0
packages/@uppy/react/types/index.d.ts

@@ -0,0 +1,7 @@
+import * as React from 'react';
+
+export { default as Dashboard } from '../src/Dashboard';
+export { default as DashboardModal } from '../src/DashboardModal';
+export { default as DragDrop } from '../src/DragDrop';
+export { default as ProgressBar } from '../src/ProgressBar';
+export { default as StatusBar } from '../src/StatusBar';

+ 8 - 4
packages/@uppy/redux-dev-tools/types/index.d.ts

@@ -1,14 +1,18 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface ReduxDevToolsOptions extends PluginOptions {
+declare module ReduxDevTools {
+  interface ReduxDevToolsOptions extends PluginOptions {
+  }
 }
 
-export default class ReduxDevTools extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<ReduxDevToolsOptions>);
+declare class ReduxDevTools extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<ReduxDevTools.ReduxDevToolsOptions>);
 }
 
+export = ReduxDevTools;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof ReduxDevTools, opts: Partial<ReduxDevToolsOptions>): Uppy;
+    use(pluginClass: typeof ReduxDevTools, opts: Partial<ReduxDevTools.ReduxDevToolsOptions>): Uppy;
   }
 }

+ 11 - 7
packages/@uppy/status-bar/types/index.d.ts

@@ -1,17 +1,21 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface StatusBarOptions extends PluginOptions {
-  showProgressDetails: boolean;
-  hideUploadButton: boolean;
-  hideAfterFinish: boolean;
+declare module StatusBar {
+  export interface StatusBarOptions extends PluginOptions {
+    showProgressDetails: boolean;
+    hideUploadButton: boolean;
+    hideAfterFinish: boolean;
+  }
 }
 
-export default class StatusBar extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<StatusBarOptions>);
+declare class StatusBar extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<StatusBar.StatusBarOptions>);
 }
 
+export = StatusBar;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof StatusBar, opts: Partial<StatusBarOptions>): Uppy;
+    use(pluginClass: typeof StatusBar, opts: Partial<StatusBar.StatusBarOptions>): Uppy;
   }
 }

+ 2 - 1
packages/@uppy/store-default/types/index.d.ts

@@ -7,4 +7,5 @@ declare class DefaultStore implements Store {
   subscribe(listener: any): () => void;
 }
 
-export default function createDefaultStore(): DefaultStore;
+declare function createDefaultStore(): DefaultStore;
+export = createDefaultStore;

+ 8 - 1
packages/@uppy/store-redux/types/index.d.ts

@@ -14,6 +14,13 @@ declare class ReduxStore implements Store {
   subscribe(listener: any): () => void;
 }
 
-export default function createReduxStore(opts: ReduxStoreOptions): ReduxStore;
 export const reducer: Reducer<object>;
 export const middleware: Middleware;
+// Redux action name.
+export const STATE_UPDATE: string;
+
+// Typescript forbids the next two lines with the following error message:
+// "An export assignment cannot be used in a module with other exported elements."
+
+// declare function createReduxStore(opts: ReduxStoreOptions): ReduxStore;
+// export = createReduxStore;

+ 9 - 5
packages/@uppy/thumbnail-generator/types/index.d.ts

@@ -1,15 +1,19 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface ThumbnailGeneratorOptions extends PluginOptions {
-  thumbnailWidth: number;
+declare module ThumbnailGenerator {
+  interface ThumbnailGeneratorOptions extends PluginOptions {
+    thumbnailWidth: number;
+  }
 }
 
-export default class ThumbnailGenerator extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<ThumbnailGeneratorOptions>);
+declare class ThumbnailGenerator extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<ThumbnailGenerator.ThumbnailGeneratorOptions>);
 }
 
+export = ThumbnailGenerator;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof ThumbnailGenerator, opts: Partial<ThumbnailGeneratorOptions>): Uppy;
+    use(pluginClass: typeof ThumbnailGenerator, opts: Partial<ThumbnailGenerator.ThumbnailGeneratorOptions>): Uppy;
   }
 }

+ 28 - 24
packages/@uppy/transloadit/types/index.d.ts

@@ -1,36 +1,40 @@
 import { Plugin, PluginOptions, Uppy, UppyFile } from '@uppy/core';
 
-export interface AssemblyParameters {
-  auth: { key: string };
-  template_id?: string;
-  steps?: { [step: string]: object };
-  notify_url?: string;
-  fields?: { [name: string]: number | string };
-}
+declare module Transloadit {
+  interface AssemblyParameters {
+    auth: { key: string };
+    template_id?: string;
+    steps?: { [step: string]: object };
+    notify_url?: string;
+    fields?: { [name: string]: number | string };
+  }
 
-export interface AssemblyOptions {
-  params: AssemblyParameters;
-  fields?: { [name: string]: number | string };
-  signature?: string;
-}
+  interface AssemblyOptions {
+    params: AssemblyParameters;
+    fields?: { [name: string]: number | string };
+    signature?: string;
+  }
 
-export interface TransloaditOptions extends PluginOptions {
-  params: AssemblyParameters;
-  signature: string;
-  service: string;
-  waitForEncoding: boolean;
-  waitForMetadata: boolean;
-  importFromUploadURLs: boolean;
-  alwaysRunAssembly: boolean;
-  getAssemblyOptions: (file: UppyFile) => AssemblyOptions | Promise<AssemblyOptions>;
+  interface TransloaditOptions extends PluginOptions {
+    params: AssemblyParameters;
+    signature: string;
+    service: string;
+    waitForEncoding: boolean;
+    waitForMetadata: boolean;
+    importFromUploadURLs: boolean;
+    alwaysRunAssembly: boolean;
+    getAssemblyOptions: (file: UppyFile) => AssemblyOptions | Promise<AssemblyOptions>;
+  }
 }
 
-export default class Transloadit extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<TransloaditOptions>);
+declare class Transloadit extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Transloadit.TransloaditOptions>);
 }
 
+export = Transloadit;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Transloadit, opts: Partial<TransloaditOptions>): Uppy;
+    use(pluginClass: typeof Transloadit, opts: Partial<Transloadit.TransloaditOptions>): Uppy;
   }
 }

+ 14 - 10
packages/@uppy/tus/types/index.d.ts

@@ -1,20 +1,24 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface TusOptions extends PluginOptions {
-  limit: number;
-  endpoint: string;
-  uploadUrl: string;
-  useFastRemoteRetry: boolean;
-  resume: boolean;
-  autoRetry: boolean;
+declare module Tus {
+  export interface TusOptions extends PluginOptions {
+    limit: number;
+    endpoint: string;
+    uploadUrl: string;
+    useFastRemoteRetry: boolean;
+    resume: boolean;
+    autoRetry: boolean;
+  }
 }
 
-export default class Tus extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<TusOptions>);
+declare class Tus extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Tus.TusOptions>);
 }
 
+export = Tus;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Tus, opts: Partial<TusOptions>): Uppy;
+    use(pluginClass: typeof Tus, opts: Partial<Tus.TusOptions>): Uppy;
   }
 }

+ 10 - 6
packages/@uppy/url/types/index.d.ts

@@ -1,16 +1,20 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface UrlOptions extends PluginOptions {
-  serverUrl: string;
-  // TODO inherit from ProviderOptions
+declare module Url {
+  export interface UrlOptions extends PluginOptions {
+    serverUrl: string;
+    // TODO inherit from ProviderOptions
+  }
 }
 
-export default class Url extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<UrlOptions>);
+declare class Url extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<Url.UrlOptions>);
 }
 
+export = Url;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Url, opts: Partial<UrlOptions>): Uppy;
+    use(pluginClass: typeof Url, opts: Partial<Url.UrlOptions>): Uppy;
   }
 }

+ 17 - 12
packages/@uppy/webcam/types/index.d.ts

@@ -1,21 +1,26 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture';
+declare module Webcam {
 
-export interface WebcamOptions extends PluginOptions {
-  onBeforeSnapshot?: () => Promise<void>;
-  countdown?: number | boolean;
-  mirror?: boolean;
-  facingMode?: string;
-  modes: WebcamMode[];
+    export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture';
+
+    export interface WebcamOptions extends PluginOptions {
+        onBeforeSnapshot?: () => Promise<void>;
+        countdown?: number | boolean;
+        mirror?: boolean;
+        facingMode?: string;
+        modes: WebcamMode[];
+    }
 }
 
-export default class Webcam extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<WebcamOptions>);
+declare class Webcam extends Plugin {
+    constructor(uppy: Uppy, opts: Partial<Webcam.WebcamOptions>);
 }
 
+export = Webcam;
+
 declare module '@uppy/core' {
-  export interface Uppy {
-    use(pluginClass: typeof Webcam, opts: Partial<WebcamOptions>): Uppy;
-  }
+    export interface Uppy {
+        use(pluginClass: typeof Webcam, opts: Partial<Webcam.WebcamOptions>): Uppy;
+    }
 }

+ 18 - 14
packages/@uppy/xhr-upload/types/index.d.ts

@@ -1,24 +1,28 @@
 import { Plugin, PluginOptions, Uppy } from '@uppy/core';
 
-export interface XHRUploadOptions extends PluginOptions {
-  limit: string;
-  bundle: boolean;
-  formData: FormData;
-  headers: any;
-  metaFields: string[];
-  fieldName: string;
-  timeout: number;
-  responseUrlFieldName: string;
-  endpoint: string;
-  method: 'GET' | 'POST' | 'HEAD';
+declare module XHRUpload {
+  export interface XHRUploadOptions extends PluginOptions {
+    limit: string;
+    bundle: boolean;
+    formData: FormData;
+    headers: any;
+    metaFields: string[];
+    fieldName: string;
+    timeout: number;
+    responseUrlFieldName: string;
+    endpoint: string;
+    method: 'GET' | 'POST' | 'HEAD';
+  }
 }
 
-export default class XHRUpload extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<XHRUploadOptions>);
+declare class XHRUpload extends Plugin {
+  constructor(uppy: Uppy, opts: Partial<XHRUpload.XHRUploadOptions>);
 }
 
+export = XHRUpload;
+
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof XHRUpload, opts: Partial<XHRUploadOptions>): Uppy;
+    use(pluginClass: typeof XHRUpload, opts: Partial<XHRUpload.XHRUploadOptions>): Uppy;
   }
 }

+ 3 - 1
packages/uppy/types/index.d.ts

@@ -6,7 +6,9 @@
 export { default as Core } from '@uppy/core';
 
 // Stores
-export { default as DefaultStore } from '@uppy/store-default';
+import DefaultStore = require('@uppy/store-default');
+export { DefaultStore };  // this is weird: exporting a function as something that sounds like a class name!
+// do we really mean what the line above says?
 export { default as ReduxStore } from '@uppy/store-redux';
 
 // UI plugins