From c8cb89bde08d95b600414a22e2f62d540b223eff Mon Sep 17 00:00:00 2001 From: Matthias Bohlen Date: Mon, 12 Nov 2018 12:05:54 +0100 Subject: [PATCH] Convert to "export =" everywhere because... ...the *.js source files use "module.exports = " instead of "export default". --- .../@uppy/aws-s3-multipart/types/index.d.ts | 38 ++++++------- packages/@uppy/aws-s3/types/index.d.ts | 32 ++++++----- packages/@uppy/dashboard/types/index.d.ts | 50 +++++++++-------- packages/@uppy/drag-drop/types/index.d.ts | 22 ++++---- packages/@uppy/dropbox/types/index.d.ts | 16 +++--- packages/@uppy/file-input/types/index.d.ts | 16 +++--- packages/@uppy/form/types/index.d.ts | 22 ++++---- .../@uppy/golden-retriever/types/index.d.ts | 18 ++++--- packages/@uppy/google-drive/types/index.d.ts | 16 +++--- packages/@uppy/informer/types/index.d.ts | 26 +++++---- packages/@uppy/instagram/types/index.d.ts | 16 +++--- packages/@uppy/progress-bar/types/index.d.ts | 16 +++--- .../@uppy/redux-dev-tools/types/index.d.ts | 12 +++-- packages/@uppy/status-bar/types/index.d.ts | 18 ++++--- packages/@uppy/store-default/types/index.d.ts | 3 +- packages/@uppy/store-redux/types/index.d.ts | 9 +++- .../thumbnail-generator/types/index.d.ts | 14 +++-- packages/@uppy/transloadit/types/index.d.ts | 54 ++++++++++--------- packages/@uppy/tus/types/index.d.ts | 24 +++++---- packages/@uppy/url/types/index.d.ts | 16 +++--- packages/@uppy/xhr-upload/types/index.d.ts | 32 ++++++----- 21 files changed, 275 insertions(+), 195 deletions(-) diff --git a/packages/@uppy/aws-s3-multipart/types/index.d.ts b/packages/@uppy/aws-s3-multipart/types/index.d.ts index 8152ed76c..f3c9f02a0 100644 --- a/packages/@uppy/aws-s3-multipart/types/index.d.ts +++ b/packages/@uppy/aws-s3-multipart/types/index.d.ts @@ -1,32 +1,32 @@ import { Plugin, PluginOptions, Uppy, UppyFile } from '@uppy/core'; declare module AwsS3Multipart { - interface AwsS3Part { - PartNumber?: number; - Size?: number; - ETag?: string; - } + interface AwsS3Part { + PartNumber?: number; + Size?: number; + ETag?: string; + } - interface AwsS3MultipartOptions extends PluginOptions { - serverUrl: string; - createMultipartUpload(file: UppyFile): Promise<{ uploadId: string, key: string }>; - listParts(file: UppyFile, opts: { uploadId: string, key: string }): Promise; - prepareUploadPart(file: UppyFile, partData: { uploadId: string, key: string, body: Blob, number: number }): Promise<{ url: string }>; - abortMultipartUpload(file: UppyFile, opts: { uploadId: string, key: string }): Promise; - 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; + prepareUploadPart(file: UppyFile, partData: { uploadId: string, key: string, body: Blob, number: number }): Promise<{ url: string }>; + abortMultipartUpload(file: UppyFile, opts: { uploadId: string, key: string }): Promise; + completeMultipartUpload(file: 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); + constructor(uppy: Uppy, opts: Partial); } export = AwsS3Multipart; declare module '@uppy/core' { - export interface Uppy { - use(pluginClass: typeof AwsS3Multipart, opts: Partial): Uppy; - } + export interface Uppy { + use(pluginClass: typeof AwsS3Multipart, opts: Partial): Uppy; + } } diff --git a/packages/@uppy/aws-s3/types/index.d.ts b/packages/@uppy/aws-s3/types/index.d.ts index 749995000..2d06599b8 100644 --- a/packages/@uppy/aws-s3/types/index.d.ts +++ b/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 }; + } + + interface AwsS3Options extends PluginOptions { + serverUrl: string; + getUploadParameters(file: UppyFile): Promise; + timeout: number; + limit: number; + } } -export interface AwsS3Options extends PluginOptions { - serverUrl: string; - getUploadParameters(file: UppyFile): Promise; - timeout: number; - limit: number; +declare class AwsS3 extends Plugin { + constructor(uppy: Uppy, opts: Partial); } -export default class AwsS3 extends Plugin { - constructor(uppy: Uppy, opts: Partial); -} +export = AwsS3; declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof AwsS3, opts: Partial): Uppy; + use(pluginClass: typeof AwsS3, opts: Partial): Uppy; } } diff --git a/packages/@uppy/dashboard/types/index.d.ts b/packages/@uppy/dashboard/types/index.d.ts index 3879623c2..6722be375 100644 --- a/packages/@uppy/dashboard/types/index.d.ts +++ b/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); +declare class Dashboard extends Plugin { + constructor(uppy: Uppy, opts: Partial); 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): Uppy; + use(pluginClass: typeof Dashboard, opts: Partial): Uppy; } } diff --git a/packages/@uppy/drag-drop/types/index.d.ts b/packages/@uppy/drag-drop/types/index.d.ts index 8879ec7dc..d1cb46593 100644 --- a/packages/@uppy/drag-drop/types/index.d.ts +++ b/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); +declare class DragDrop extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = DragDrop; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof DragDrop, opts: Partial): Uppy; + use(pluginClass: typeof DragDrop, opts: Partial): Uppy; } } diff --git a/packages/@uppy/dropbox/types/index.d.ts b/packages/@uppy/dropbox/types/index.d.ts index daa51b743..8849c2ee1 100644 --- a/packages/@uppy/dropbox/types/index.d.ts +++ b/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; +declare module Dropbox { + interface DropboxOptions extends PluginOptions, ProviderOptions { + serverUrl: string; + serverPattern: string | RegExp | Array; + } } -export default class Dropbox extends Plugin { - constructor(uppy: Uppy, opts: Partial); +declare class Dropbox extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = Dropbox; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Dropbox, opts: Partial): Uppy; + use(pluginClass: typeof Dropbox, opts: Partial): Uppy; } } diff --git a/packages/@uppy/file-input/types/index.d.ts b/packages/@uppy/file-input/types/index.d.ts index 84419e70c..a81067060 100644 --- a/packages/@uppy/file-input/types/index.d.ts +++ b/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); +declare class FileInput extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = FileInput; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof FileInput, opts: Partial): Uppy; + use(pluginClass: typeof FileInput, opts: Partial): Uppy; } } diff --git a/packages/@uppy/form/types/index.d.ts b/packages/@uppy/form/types/index.d.ts index 8170f6262..1a84ad0a5 100644 --- a/packages/@uppy/form/types/index.d.ts +++ b/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); +declare class Form extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = Form; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Form, opts: Partial): Uppy; + use(pluginClass: typeof Form, opts: Partial): Uppy; } } diff --git a/packages/@uppy/golden-retriever/types/index.d.ts b/packages/@uppy/golden-retriever/types/index.d.ts index 3a0465679..ed02a30cf 100644 --- a/packages/@uppy/golden-retriever/types/index.d.ts +++ b/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); +declare class GoldenRetriever extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = GoldenRetriever; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof GoldenRetriever, opts: Partial): Uppy; + use(pluginClass: typeof GoldenRetriever, opts: Partial): Uppy; } } diff --git a/packages/@uppy/google-drive/types/index.d.ts b/packages/@uppy/google-drive/types/index.d.ts index 2c3c93af9..787ddbca6 100644 --- a/packages/@uppy/google-drive/types/index.d.ts +++ b/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; +declare module GoogleDrive { + interface GoogleDriveOptions extends PluginOptions, ProviderOptions { + serverUrl: string; + serverPattern: string | RegExp | Array; + } } -export default class GoogleDrive extends Plugin { - constructor(uppy: Uppy, opts: Partial); +declare class GoogleDrive extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = GoogleDrive; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof GoogleDrive, opts: Partial): Uppy; + use(pluginClass: typeof GoogleDrive, opts: Partial): Uppy; } } diff --git a/packages/@uppy/informer/types/index.d.ts b/packages/@uppy/informer/types/index.d.ts index 5ef445cb6..b85f7a32c 100644 --- a/packages/@uppy/informer/types/index.d.ts +++ b/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; + } + + interface InformerOptions extends PluginOptions { + typeColors: { + [type: string]: Color + }; + } } -export interface InformerOptions extends PluginOptions { - typeColors: { - [type: string]: Color - }; +declare class Informer extends Plugin { + constructor(uppy: Uppy, opts: Partial); } -export default class Informer extends Plugin { - constructor(uppy: Uppy, opts: Partial); -} +export = Informer; declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Informer, opts: Partial): Uppy; + use(pluginClass: typeof Informer, opts: Partial): Uppy; } } diff --git a/packages/@uppy/instagram/types/index.d.ts b/packages/@uppy/instagram/types/index.d.ts index c3ee2c819..ae3b06289 100644 --- a/packages/@uppy/instagram/types/index.d.ts +++ b/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; +declare module Instagram { + interface InstagramOptions extends PluginOptions, ProviderOptions { + serverUrl: string; + serverPattern: string | RegExp | Array; + } } -export default class Instagram extends Plugin { - constructor(uppy: Uppy, opts: Partial); +declare class Instagram extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = Instagram; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Instagram, opts: Partial): Uppy; + use(pluginClass: typeof Instagram, opts: Partial): Uppy; } } diff --git a/packages/@uppy/progress-bar/types/index.d.ts b/packages/@uppy/progress-bar/types/index.d.ts index bbab49553..c07e0a6a4 100644 --- a/packages/@uppy/progress-bar/types/index.d.ts +++ b/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); +declare class ProgressBar extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = ProgressBar; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof ProgressBar, opts: Partial): Uppy; + use(pluginClass: typeof ProgressBar, opts: Partial): Uppy; } } diff --git a/packages/@uppy/redux-dev-tools/types/index.d.ts b/packages/@uppy/redux-dev-tools/types/index.d.ts index 7787bcdda..fb7d20433 100644 --- a/packages/@uppy/redux-dev-tools/types/index.d.ts +++ b/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); +declare class ReduxDevTools extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = ReduxDevTools; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof ReduxDevTools, opts: Partial): Uppy; + use(pluginClass: typeof ReduxDevTools, opts: Partial): Uppy; } } diff --git a/packages/@uppy/status-bar/types/index.d.ts b/packages/@uppy/status-bar/types/index.d.ts index dd2c0d232..3f3f9f2ee 100644 --- a/packages/@uppy/status-bar/types/index.d.ts +++ b/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); +declare class StatusBar extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = StatusBar; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof StatusBar, opts: Partial): Uppy; + use(pluginClass: typeof StatusBar, opts: Partial): Uppy; } } diff --git a/packages/@uppy/store-default/types/index.d.ts b/packages/@uppy/store-default/types/index.d.ts index 114c79417..787551847 100644 --- a/packages/@uppy/store-default/types/index.d.ts +++ b/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; \ No newline at end of file diff --git a/packages/@uppy/store-redux/types/index.d.ts b/packages/@uppy/store-redux/types/index.d.ts index b7d7597f0..0a3402c87 100644 --- a/packages/@uppy/store-redux/types/index.d.ts +++ b/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; 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; diff --git a/packages/@uppy/thumbnail-generator/types/index.d.ts b/packages/@uppy/thumbnail-generator/types/index.d.ts index 7b14465df..f5284045e 100644 --- a/packages/@uppy/thumbnail-generator/types/index.d.ts +++ b/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); +declare class ThumbnailGenerator extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = ThumbnailGenerator; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof ThumbnailGenerator, opts: Partial): Uppy; + use(pluginClass: typeof ThumbnailGenerator, opts: Partial): Uppy; } } diff --git a/packages/@uppy/transloadit/types/index.d.ts b/packages/@uppy/transloadit/types/index.d.ts index 5a4db694e..99b911640 100644 --- a/packages/@uppy/transloadit/types/index.d.ts +++ b/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 }; + } + + interface AssemblyOptions { + params: AssemblyParameters; + fields?: { [name: string]: number | string }; + signature?: string; + } + + interface TransloaditOptions extends PluginOptions { + params: AssemblyParameters; + signature: string; + service: string; + waitForEncoding: boolean; + waitForMetadata: boolean; + importFromUploadURLs: boolean; + alwaysRunAssembly: boolean; + getAssemblyOptions: (file: UppyFile) => AssemblyOptions | Promise; + } } -export interface AssemblyOptions { - params: AssemblyParameters; - fields?: { [name: string]: number | string }; - signature?: string; +declare class Transloadit extends Plugin { + constructor(uppy: Uppy, opts: Partial); } -export interface TransloaditOptions extends PluginOptions { - params: AssemblyParameters; - signature: string; - service: string; - waitForEncoding: boolean; - waitForMetadata: boolean; - importFromUploadURLs: boolean; - alwaysRunAssembly: boolean; - getAssemblyOptions: (file: UppyFile) => AssemblyOptions | Promise; -} - -export default class Transloadit extends Plugin { - constructor(uppy: Uppy, opts: Partial); -} +export = Transloadit; declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Transloadit, opts: Partial): Uppy; + use(pluginClass: typeof Transloadit, opts: Partial): Uppy; } } diff --git a/packages/@uppy/tus/types/index.d.ts b/packages/@uppy/tus/types/index.d.ts index 7ebde1c66..28409c87c 100644 --- a/packages/@uppy/tus/types/index.d.ts +++ b/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); +declare class Tus extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = Tus; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Tus, opts: Partial): Uppy; + use(pluginClass: typeof Tus, opts: Partial): Uppy; } } diff --git a/packages/@uppy/url/types/index.d.ts b/packages/@uppy/url/types/index.d.ts index 5f43c4089..25ac50edd 100644 --- a/packages/@uppy/url/types/index.d.ts +++ b/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); +declare class Url extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = Url; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof Url, opts: Partial): Uppy; + use(pluginClass: typeof Url, opts: Partial): Uppy; } } diff --git a/packages/@uppy/xhr-upload/types/index.d.ts b/packages/@uppy/xhr-upload/types/index.d.ts index ee8f9291f..56e3714ef 100644 --- a/packages/@uppy/xhr-upload/types/index.d.ts +++ b/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); +declare class XHRUpload extends Plugin { + constructor(uppy: Uppy, opts: Partial); } +export = XHRUpload; + declare module '@uppy/core' { export interface Uppy { - use(pluginClass: typeof XHRUpload, opts: Partial): Uppy; + use(pluginClass: typeof XHRUpload, opts: Partial): Uppy; } }