From 509763f3b20ebd2530478c3aa875aea631e01fba Mon Sep 17 00:00:00 2001 From: Jeroen Akkerman Date: Wed, 24 Jul 2019 14:26:11 +0200 Subject: [PATCH] Stricter typings for the onSuccess and onError calls --- types/easymde-test.ts | 6 ++++-- types/easymde.d.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/easymde-test.ts b/types/easymde-test.ts index 103569b..75975f8 100644 --- a/types/easymde-test.ts +++ b/types/easymde-test.ts @@ -92,8 +92,10 @@ const editorImagesCustom = new EasyMDE({ imageAccept: 'image/png, image/bmp', imageCSRFToken: undefined, imageMaxSize: 10485760, - imageUploadFunction: (file: File, onSuccess: Function, onError: Function) => { - console.log(file) + imageUploadFunction: (file: File, onSuccess, onError) => { + console.log(file); + onSuccess('http://image.url/9.png'); + onError('Failed because reasons.'); }, imageTexts: { sbInit: 'Drag & drop images!', diff --git a/types/easymde.d.ts b/types/easymde.d.ts index 1fa121c..dd4bd4d 100644 --- a/types/easymde.d.ts +++ b/types/easymde.d.ts @@ -134,7 +134,7 @@ declare namespace EasyMDE { uploadImage?: boolean; imageMaxSize?: number; imageAccept?: string; - imageUploadFunction?: (file: File, onSuccess: Function, onError: Function) => void; + imageUploadFunction?: (file: File, onSuccess: (url: string) => void, onError: (error: string) => void) => void; imageUploadEndpoint?: string; imageCSRFToken?: string; imageTexts?: ImageTextsOptions;