Browse Source

Use `export =` in @uppy/core typings.

Renée Kooi 6 years ago
parent
commit
3710b19e1b

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

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

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

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

+ 4 - 4
packages/@uppy/companion-client/types/index.d.ts

@@ -1,4 +1,4 @@
-import { Uppy, Plugin } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 export interface RequestClientOptions {
   serverUrl: string;
@@ -6,7 +6,7 @@ export interface RequestClientOptions {
 }
 
 export class RequestClient {
-  constructor (uppy: Uppy, opts: RequestClientOptions);
+  constructor (uppy: Uppy.Uppy, opts: RequestClientOptions);
   get (path: string): Promise<any>;
   post (path: string, data: object): Promise<any>;
   delete (path: string, data: object): Promise<any>;
@@ -19,13 +19,13 @@ export interface ProviderOptions extends RequestClientOptions {
 }
 
 export class Provider extends RequestClient {
-  constructor (uppy: Uppy, opts: ProviderOptions);
+  constructor (uppy: Uppy.Uppy, opts: ProviderOptions);
   checkAuth (): Promise<boolean>;
   authUrl (): string;
   fileUrl (id: string): string;
   list (directory: string): Promise<any>;
   logout (redirect?: string): Promise<any>;
-  static initPlugin(plugin: Plugin, opts: object, defaultOpts?: object): void;
+  static initPlugin(plugin: Uppy.Plugin, opts: object, defaultOpts?: object): void;
 }
 
 export interface SocketOptions {

+ 1 - 1
packages/@uppy/core/types/core-tests.ts

@@ -1,4 +1,4 @@
-import Uppy, { UppyFile } from '../';
+import Uppy = require('../');
 
 {
   const uppy = Uppy();

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

@@ -1,166 +1,170 @@
-interface IndexedObject<T> {
-  [key: string]: T;
-  [key: number]: T;
-}
-export interface UppyFile<TMeta extends IndexedObject<any> = {}> {
-  data: Blob | File;
-  extension: string;
-  id: string;
-  isPaused?: boolean;
-  isRemote: boolean;
-  meta: {
+declare module Uppy {
+  interface IndexedObject<T> {
+    [key: string]: T;
+    [key: number]: T;
+  }
+  interface UppyFile<TMeta extends IndexedObject<any> = {}> {
+    data: Blob | File;
+    extension: string;
+    id: string;
+    isPaused?: boolean;
+    isRemote: boolean;
+    meta: {
+      name: string;
+      type?: string;
+    } & TMeta;
     name: string;
+    preview?: string;
+    progress?: {
+      uploadStarted: number;
+      uploadComplete: boolean;
+      percentage: number;
+      bytesUploaded: number;
+      bytesTotal: number;
+    };
+    remote?: {
+      host: string;
+      url: string;
+      body?: object;
+    };
+    size: number;
+    source?: string;
     type?: string;
-  } & TMeta;
-  name: string;
-  preview?: string;
-  progress?: {
-    uploadStarted: number;
-    uploadComplete: boolean;
-    percentage: number;
-    bytesUploaded: number;
-    bytesTotal: number;
-  };
-  remote?: {
-    host: string;
-    url: string;
-    body?: object;
-  };
-  size: number;
-  source?: string;
-  type?: string;
-}
+  }
 
-export interface UploadedUppyFile<TMeta extends IndexedObject<any> = {}> extends UppyFile<TMeta> {
-  uploadURL: string;
-}
+  interface UploadedUppyFile<TMeta extends IndexedObject<any> = {}> extends UppyFile<TMeta> {
+    uploadURL: string;
+  }
 
-export interface FailedUppyFile<TMeta extends IndexedObject<any> = {}> extends UppyFile<TMeta> {
-  error: string;
-}
+  interface FailedUppyFile<TMeta extends IndexedObject<any> = {}> extends UppyFile<TMeta> {
+    error: string;
+  }
 
-export interface AddFileOptions extends Partial<UppyFile> {
-  // `.data` is the only required property here.
-  data: Blob | File;
-}
+  interface AddFileOptions extends Partial<UppyFile> {
+    // `.data` is the only required property here.
+    data: Blob | File;
+  }
 
-export interface PluginOptions {
-  id?: string;
-}
+  interface PluginOptions {
+    id?: string;
+  }
 
-export class Plugin {
-  id: string;
-  uppy: Uppy;
-  type: string;
-  constructor(uppy: Uppy, opts?: PluginOptions);
-  getPluginState(): object;
-  setPluginState(update: any): object;
-  update(state?: object): void;
-  mount(target: any, plugin: any): void;
-  render(state: object): void;
-  addTarget(plugin: any): void;
-  unmount(): void;
-  install(): void;
-  uninstall(): void;
-}
+  class Plugin {
+    id: string;
+    uppy: Uppy;
+    type: string;
+    constructor(uppy: Uppy, opts?: PluginOptions);
+    getPluginState(): object;
+    setPluginState(update: any): object;
+    update(state?: object): void;
+    mount(target: any, plugin: any): void;
+    render(state: object): void;
+    addTarget(plugin: any): void;
+    unmount(): void;
+    install(): void;
+    uninstall(): void;
+  }
 
-export interface Store {
-  getState(): object;
-  setState(patch: object): void;
-  subscribe(listener: any): () => void;
-}
+  interface Store {
+    getState(): object;
+    setState(patch: object): void;
+    subscribe(listener: any): () => void;
+  }
 
-interface LocaleStrings {
-  [key: string]: string | LocaleStrings;
-}
-interface Locale {
-  strings: LocaleStrings;
-  pluralize?: (n: number) => number;
-}
+  interface LocaleStrings {
+    [key: string]: string | LocaleStrings;
+  }
+  interface Locale {
+    strings: LocaleStrings;
+    pluralize?: (n: number) => number;
+  }
 
-export interface UppyOptions {
-  id: string;
-  autoProceed: boolean;
-  allowMultipleUploads: boolean;
-  debug: boolean;
-  restrictions: {
-    maxFileSize: number | null;
-    maxNumberOfFiles: number | null;
-    minNumberOfFiles: number | null;
-    allowedFileTypes: string[] | null;
-  };
-  target: string | Plugin;
-  meta: any;
-  onBeforeFileAdded: (currentFile: UppyFile, files: {[key: string]: UppyFile}) => UppyFile | boolean | undefined;
-  onBeforeUpload: (files: {[key: string]: UppyFile}) => {[key: string]: UppyFile} | boolean;
-  locale: Locale;
-  store: Store;
-}
+  interface UppyOptions {
+    id: string;
+    autoProceed: boolean;
+    allowMultipleUploads: boolean;
+    debug: boolean;
+    restrictions: {
+      maxFileSize: number | null;
+      maxNumberOfFiles: number | null;
+      minNumberOfFiles: number | null;
+      allowedFileTypes: string[] | null;
+    };
+    target: string | Plugin;
+    meta: any;
+    onBeforeFileAdded: (currentFile: UppyFile, files: {[key: string]: UppyFile}) => UppyFile | boolean | undefined;
+    onBeforeUpload: (files: {[key: string]: UppyFile}) => {[key: string]: UppyFile} | boolean;
+    locale: Locale;
+    store: Store;
+  }
 
-export interface UploadResult<TMeta extends IndexedObject<any> = {}> {
-  successful: UploadedUppyFile<TMeta>[];
-  failed: FailedUppyFile<TMeta>[];
-}
+  interface UploadResult<TMeta extends IndexedObject<any> = {}> {
+    successful: UploadedUppyFile<TMeta>[];
+    failed: FailedUppyFile<TMeta>[];
+  }
 
-interface State<TMeta extends IndexedObject<any> = {}> extends IndexedObject<any> {
-  capabilities?: {resumableUploads?: boolean};
-  currentUploads: {};
-  error?: string;
-  files: {[key: string]: UploadedUppyFile<TMeta> | FailedUppyFile<TMeta>};
-  info?: {
-    isHidden: boolean;
-    type: string;
-    message: string;
-    details: string;
-  };
-  plugins?: IndexedObject<any>;
-  totalProgress: number;
-}
-type LogLevel = 'info' | 'warning' | 'error';
-export class Uppy {
-  constructor(opts?: Partial<UppyOptions>);
-  on(event: 'upload-success', callback: (file: UppyFile, body: any, uploadURL: string) => void): Uppy;
-  on(event: 'complete', callback: (result: UploadResult) => void): Uppy;
-  on(event: string, callback: (...args: any[]) => void): Uppy;
-  off(event: string, callback: any): Uppy;
-  updateAll(state: object): void;
-  setState(patch: object): void;
-  getState<TMeta extends IndexedObject<any> = {}>(): State<TMeta>;
-  readonly state: State;
-  setFileState(fileID: string, state: object): void;
-  resetProgress(): void;
-  addPreProcessor(fn: any): void;
-  removePreProcessor(fn: any): void;
-  addPostProcessor(fn: any): void;
-  removePostProcessor(fn: any): void;
-  addUploader(fn: any): void;
-  removeUploader(fn: any): void;
-  setMeta(data: any): void;
-  setFileMeta(fileID: string, data: object): void;
-  getFile<TMeta extends IndexedObject<any> = {}>(fileID: string): UppyFile<TMeta>;
-  getFiles<TMeta extends IndexedObject<any> = {}>(): Array<UppyFile<TMeta>>;
-  addFile(file: AddFileOptions): void;
-  removeFile(fileID: string): void;
-  pauseResume(fileID: string): boolean;
-  pauseAll(): void;
-  resumeAll(): void;
-  retryAll(): void;
-  cancelAll(): void;
-  retryUpload(fileID: string): any;
-  reset(): void;
-  getID(): string;
-  use<T extends typeof Plugin>(pluginClass: T, opts: object): Uppy;
-  getPlugin(name: string): Plugin;
-  iteratePlugins(callback: (plugin: Plugin) => void): void;
-  removePlugin(instance: Plugin): void;
-  close(): void;
-  info(message: string | {message: string; details: string}, type?: LogLevel, duration?: number): void;
-  hideInfo(): void;
-  log(msg: string, type?: LogLevel): void;
-  run(): Uppy;
-  restore(uploadID: string): Promise<UploadResult>;
-  addResultData(uploadID: string, data: object): void;
-  upload(): Promise<UploadResult>;
+  interface State<TMeta extends IndexedObject<any> = {}> extends IndexedObject<any> {
+    capabilities?: {resumableUploads?: boolean};
+    currentUploads: {};
+    error?: string;
+    files: {[key: string]: UploadedUppyFile<TMeta> | FailedUppyFile<TMeta>};
+    info?: {
+      isHidden: boolean;
+      type: string;
+      message: string;
+      details: string;
+    };
+    plugins?: IndexedObject<any>;
+    totalProgress: number;
+  }
+  type LogLevel = 'info' | 'warning' | 'error';
+  class Uppy {
+    constructor(opts?: Partial<UppyOptions>);
+    on(event: 'upload-success', callback: (file: UppyFile, body: any, uploadURL: string) => void): Uppy;
+    on(event: 'complete', callback: (result: UploadResult) => void): Uppy;
+    on(event: string, callback: (...args: any[]) => void): Uppy;
+    off(event: string, callback: any): Uppy;
+    updateAll(state: object): void;
+    setState(patch: object): void;
+    getState<TMeta extends IndexedObject<any> = {}>(): State<TMeta>;
+    readonly state: State;
+    setFileState(fileID: string, state: object): void;
+    resetProgress(): void;
+    addPreProcessor(fn: any): void;
+    removePreProcessor(fn: any): void;
+    addPostProcessor(fn: any): void;
+    removePostProcessor(fn: any): void;
+    addUploader(fn: any): void;
+    removeUploader(fn: any): void;
+    setMeta(data: any): void;
+    setFileMeta(fileID: string, data: object): void;
+    getFile<TMeta extends IndexedObject<any> = {}>(fileID: string): UppyFile<TMeta>;
+    getFiles<TMeta extends IndexedObject<any> = {}>(): Array<UppyFile<TMeta>>;
+    addFile(file: AddFileOptions): void;
+    removeFile(fileID: string): void;
+    pauseResume(fileID: string): boolean;
+    pauseAll(): void;
+    resumeAll(): void;
+    retryAll(): void;
+    cancelAll(): void;
+    retryUpload(fileID: string): any;
+    reset(): void;
+    getID(): string;
+    use<T extends typeof Plugin>(pluginClass: T, opts: object): Uppy;
+    getPlugin(name: string): Plugin;
+    iteratePlugins(callback: (plugin: Plugin) => void): void;
+    removePlugin(instance: Plugin): void;
+    close(): void;
+    info(message: string | {message: string; details: string}, type?: LogLevel, duration?: number): void;
+    hideInfo(): void;
+    log(msg: string, type?: LogLevel): void;
+    run(): Uppy;
+    restore(uploadID: string): Promise<UploadResult>;
+    addResultData(uploadID: string, data: object): void;
+    upload(): Promise<UploadResult>;
+  }
 }
 
-export default function createUppy(opts?: Partial<UppyOptions>): Uppy;
+declare function Uppy(opts?: Partial<Uppy.UppyOptions>): Uppy.Uppy;
+
+export = Uppy;

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

@@ -1,7 +1,7 @@
-import { Plugin, PluginOptions, Uppy } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 declare module Dashboard {
-  interface DashboardOptions extends PluginOptions {
+  interface DashboardOptions extends Uppy.PluginOptions {
     onRequestCloseModal: () => void;
     disablePageScrollWhenModalOpen: boolean;
     closeModalOnClickOutside: boolean;
@@ -24,9 +24,9 @@ declare module Dashboard {
   }
 }
 
-declare class Dashboard extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<Dashboard.DashboardOptions>);
-  addTarget(plugin: Plugin): HTMLElement;
+declare class Dashboard extends Uppy.Plugin {
+  constructor(uppy: Uppy.Uppy, opts: Partial<Dashboard.DashboardOptions>);
+  addTarget(plugin: Uppy.Plugin): HTMLElement;
   hideAllPanels(): void;
   openModal(): void;
   closeModal(): void;
@@ -40,6 +40,6 @@ export = Dashboard;
 
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Dashboard, opts: Partial<Dashboard.DashboardOptions>): Uppy;
+    use(pluginClass: typeof Dashboard, opts: Partial<Dashboard.DashboardOptions>): Uppy.Uppy;
   }
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,6 +1,6 @@
-import { Store } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
-declare class DefaultStore implements Store {
+declare class DefaultStore implements Uppy.Store {
   constructor();
   getState(): object;
   setState(patch: object): void;
@@ -8,4 +8,4 @@ declare class DefaultStore implements Store {
 }
 
 declare function createDefaultStore(): DefaultStore;
-export = createDefaultStore;
+export = createDefaultStore;

+ 19 - 21
packages/@uppy/store-redux/types/index.d.ts

@@ -1,26 +1,24 @@
-import { Store } from '@uppy/core';
+import Uppy = require('@uppy/core');
 import { Reducer, Middleware, Store as Redux } from 'redux';
 
-export interface ReduxStoreOptions {
-  store: Redux<object>;
-  id?: string;
-  selector?: (state: any) => object;
-}
-
-declare class ReduxStore implements Store {
-  constructor(opts: ReduxStoreOptions);
-  getState(): object;
-  setState(patch: object): void;
-  subscribe(listener: any): () => void;
-}
+declare namespace ReduxStore {
+  interface ReduxStoreOptions {
+    store: Redux<object>;
+    id?: string;
+    selector?: (state: any) => object;
+  }
 
-export const reducer: Reducer<object>;
-export const middleware: Middleware;
-// Redux action name.
-export const STATE_UPDATE: string;
+  interface ReduxStore extends Uppy.Store {
+    constructor(opts: ReduxStoreOptions): ReduxStore;
+    getState(): object;
+    setState(patch: object): void;
+    subscribe(listener: any): () => void;
+  }
 
-// Typescript forbids the next two lines with the following error message:
-// "An export assignment cannot be used in a module with other exported elements."
+  const reducer: Reducer<object>;
+  const middleware: Middleware;
+  const STATE_UPDATE: string;
+}
+declare function ReduxStore(opts: ReduxStore.ReduxStoreOptions): ReduxStore.ReduxStore;
 
-// declare function createReduxStore(opts: ReduxStoreOptions): ReduxStore;
-// export = createReduxStore;
+export = ReduxStore;

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

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

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

@@ -1,4 +1,4 @@
-import { Plugin, PluginOptions, Uppy, UppyFile } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 declare module Transloadit {
   interface AssemblyParameters {
@@ -15,7 +15,7 @@ declare module Transloadit {
     signature?: string;
   }
 
-  interface TransloaditOptions extends PluginOptions {
+  interface TransloaditOptions extends Uppy.PluginOptions {
     params: AssemblyParameters;
     signature: string;
     service: string;
@@ -23,18 +23,18 @@ declare module Transloadit {
     waitForMetadata: boolean;
     importFromUploadURLs: boolean;
     alwaysRunAssembly: boolean;
-    getAssemblyOptions: (file: UppyFile) => AssemblyOptions | Promise<AssemblyOptions>;
+    getAssemblyOptions: (file: Uppy.UppyFile) => AssemblyOptions | Promise<AssemblyOptions>;
   }
 }
 
-declare class Transloadit extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<Transloadit.TransloaditOptions>);
+declare class Transloadit extends Uppy.Plugin {
+  constructor(uppy: Uppy.Uppy, opts: Partial<Transloadit.TransloaditOptions>);
 }
 
 export = Transloadit;
 
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Transloadit, opts: Partial<Transloadit.TransloaditOptions>): Uppy;
+    use(pluginClass: typeof Transloadit, opts: Partial<Transloadit.TransloaditOptions>): Uppy.Uppy;
   }
 }

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

@@ -1,7 +1,7 @@
-import { Plugin, PluginOptions, Uppy } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 declare module Tus {
-  export interface TusOptions extends PluginOptions {
+  export interface TusOptions extends Uppy.PluginOptions {
     limit: number;
     endpoint: string;
     uploadUrl: string;
@@ -11,14 +11,14 @@ declare module Tus {
   }
 }
 
-declare class Tus extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<Tus.TusOptions>);
+declare class Tus extends Uppy.Plugin {
+  constructor(uppy: Uppy.Uppy, opts: Partial<Tus.TusOptions>);
 }
 
 export = Tus;
 
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof Tus, opts: Partial<Tus.TusOptions>): Uppy;
+    use(pluginClass: typeof Tus, opts: Partial<Tus.TusOptions>): Uppy.Uppy;
   }
 }

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

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

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

@@ -1,5 +1,3 @@
-import { UppyFile } from '@uppy/core';
-
 declare module '@uppy/utils/lib/Translator' {
   export interface TranslatorOptions {
     locale: {
@@ -28,13 +26,15 @@ declare module '@uppy/utils/lib/dataURItoFile' {
 }
 
 declare module '@uppy/utils/lib/emitSocketProgress' {
+  import Uppy = require('@uppy/core');
+
   interface ProgressData {
     progress: number;
     bytesUploaded: number;
     bytesTotal: number;
   }
 
-  export default function emitSocketProgress(uploader: object, progressData: ProgressData, file: UppyFile): void;
+  export default function emitSocketProgress(uploader: object, progressData: ProgressData, file: Uppy.UppyFile): void;
 }
 
 declare module '@uppy/utils/lib/findAllDOMElements' {
@@ -46,7 +46,9 @@ declare module '@uppy/utils/lib/findDOMElement' {
 }
 
 declare module '@uppy/utils/lib/generateFileID' {
-  export default function generateFileID(file: UppyFile): string;
+  import Uppy = require('@uppy/core');
+
+  export default function generateFileID(file: Uppy.UppyFile): string;
 }
 
 declare module '@uppy/utils/lib/getBytesRemaining' {
@@ -62,7 +64,9 @@ declare module '@uppy/utils/lib/getFileNameAndExtension' {
 }
 
 declare module '@uppy/utils/lib/getFileType' {
-  export default function getFileType(file: UppyFile): string | null;
+  import Uppy = require('@uppy/core');
+
+  export default function getFileType(file: Uppy.UppyFile): string | null;
 }
 
 declare module '@uppy/utils/lib/getFileTypeExtension' {

+ 5 - 6
packages/@uppy/webcam/types/index.d.ts

@@ -1,10 +1,9 @@
-import { Plugin, PluginOptions, Uppy } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 declare module Webcam {
-
     export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture';
 
-    export interface WebcamOptions extends PluginOptions {
+    export interface WebcamOptions extends Uppy.PluginOptions {
         onBeforeSnapshot?: () => Promise<void>;
         countdown?: number | boolean;
         mirror?: boolean;
@@ -13,14 +12,14 @@ declare module Webcam {
     }
 }
 
-declare class Webcam extends Plugin {
-    constructor(uppy: Uppy, opts: Partial<Webcam.WebcamOptions>);
+declare class Webcam extends Uppy.Plugin {
+    constructor(uppy: Uppy.Uppy, opts: Partial<Webcam.WebcamOptions>);
 }
 
 export = Webcam;
 
 declare module '@uppy/core' {
     export interface Uppy {
-        use(pluginClass: typeof Webcam, opts: Partial<Webcam.WebcamOptions>): Uppy;
+        use(pluginClass: typeof Webcam, opts: Partial<Webcam.WebcamOptions>): Uppy.Uppy;
     }
 }

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

@@ -1,7 +1,7 @@
-import { Plugin, PluginOptions, Uppy } from '@uppy/core';
+import Uppy = require('@uppy/core');
 
 declare module XHRUpload {
-  export interface XHRUploadOptions extends PluginOptions {
+  export interface XHRUploadOptions extends Uppy.PluginOptions {
     limit: string;
     bundle: boolean;
     formData: FormData;
@@ -15,14 +15,14 @@ declare module XHRUpload {
   }
 }
 
-declare class XHRUpload extends Plugin {
-  constructor(uppy: Uppy, opts: Partial<XHRUpload.XHRUploadOptions>);
+declare class XHRUpload extends Uppy.Plugin {
+  constructor(uppy: Uppy.Uppy, opts: Partial<XHRUpload.XHRUploadOptions>);
 }
 
 export = XHRUpload;
 
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof XHRUpload, opts: Partial<XHRUpload.XHRUploadOptions>): Uppy;
+    use(pluginClass: typeof XHRUpload, opts: Partial<XHRUpload.XHRUploadOptions>): Uppy.Uppy;
   }
 }