From a948d8b97dfbb4982d150001f214eb6f102fae9a Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Mon, 28 May 2018 10:37:41 +0200 Subject: [PATCH 1/2] add dictUploadCanceled to DropzoneOptions & make JQuery interface global & add access to Dropzone via HTMLElement --- types/dropzone/dropzone-tests.ts | 3 +++ types/dropzone/index.d.ts | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/types/dropzone/dropzone-tests.ts b/types/dropzone/dropzone-tests.ts index 4abc3a6223..d79ea2e5ad 100644 --- a/types/dropzone/dropzone-tests.ts +++ b/types/dropzone/dropzone-tests.ts @@ -57,6 +57,7 @@ const dropzoneWithOptions = new Dropzone(".test", { dictRemoveFileConfirmation: "", dictMaxFilesExceeded: "", dictFileSizeUnits: { tb: "", gb: "", mb: "", kb: "", b: "" }, + dictUploadCanceled: "", accept: (file: Dropzone.DropzoneFile, done: (error?: string | Error) => void) => { if (file.accepted) { @@ -228,6 +229,8 @@ dropzone.resizeImage(firstFile, 120, 120); dropzone.resizeImage(firstFile, 120, 120, 'contain'); dropzone.resizeImage(firstFile, 120, 120, 'contain', function () { }); +document.createElement("div").dropzone; + dropzone .on("drop", () => { console.count('drop'); diff --git a/types/dropzone/index.d.ts b/types/dropzone/index.d.ts index 0295afbed2..588749823f 100644 --- a/types/dropzone/index.d.ts +++ b/types/dropzone/index.d.ts @@ -81,6 +81,7 @@ declare namespace Dropzone { dictRemoveFileConfirmation?: string; dictMaxFilesExceeded?: string; dictFileSizeUnits?: DropzoneDictFileSizeUnits; + dictUploadCanceled?: string; accept?(file: DropzoneFile, done: (error?: string | Error) => void): void; init?(): void; @@ -299,8 +300,14 @@ declare class Dropzone { } -interface JQuery { - dropzone(options: Dropzone.DropzoneOptions): Dropzone; +declare global { + interface JQuery { + dropzone(options: Dropzone.DropzoneOptions): Dropzone; + } + + interface HTMLElement { + dropzone: Dropzone; + } } export = Dropzone; From 60ca8e490a315cef3e1bfcb405788b3582b5e54f Mon Sep 17 00:00:00 2001 From: Daniel Waxweiler Date: Mon, 28 May 2018 10:44:46 +0200 Subject: [PATCH 2/2] add name --- types/dropzone/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/dropzone/index.d.ts b/types/dropzone/index.d.ts index 588749823f..8c55f18fc7 100644 --- a/types/dropzone/index.d.ts +++ b/types/dropzone/index.d.ts @@ -1,6 +1,12 @@ // Type definitions for Dropzone 5.0.0 // Project: http://www.dropzonejs.com/ -// Definitions by: Natan Vivo , Andy Hawkins , Vasya Aksyonov , Simon Huber , Sebastiaan de Rooij , Ted Bicknell +// Definitions by: Natan Vivo +// Andy Hawkins +// Vasya Aksyonov +// Simon Huber +// Sebastiaan de Rooij +// Ted Bicknell +// Daniel Waxweiler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3