selemondev / vue3-signature-pad

A Vue 3 based smooth signature drawing component ✨
https://vue3-signature-pad.vercel.app
MIT License
44 stars 5 forks source link

Interface-Definitions: All Methods return void #18

Open leoonhitgub opened 2 weeks ago

leoonhitgub commented 2 weeks ago

Describe the bug Can not use your library in typescript, as long as all the method return -types are void..

for example: export interface CanvasSignatureRef { isCanvasEmpty?: () => void saveSignature?: (format?: string) => void clearCanvas?: () => void undo?: () => void addWaterMark?: (obj: WaterMarkObj) => void fromDataURL?: (url: string) => void }

Your following example-code on https://vue3-signature-pad.vercel.app/ does only work, because alert is very tolerant and can deal with the signature void. In true, the method is returning a string.

function handleSaveSignature() { return signature.value?.saveSignature && alert(signature.value?.saveSignature()) }

To Reproduce Steps to reproduce the behavior: use your package in typescript, write:

let imgBase64: string = signaturePad.value?.saveSignature();

You will get the following compile-error -->Vue: Type void is not assignable to type string

Expected behavior The methods of your interfaces should return the same types as your wrapped library vue-signature-pad

leoonhitgub commented 2 weeks ago

solved by using the basic library vue-signature-pad with example for vue3 as in https://codesandbox.io/p/sandbox/broken-flower-22ot7m?file=%2Fsrc%2FApp.vue

selemondev commented 2 weeks ago

Hey @leoonhitgub, thanks for creating this issue. I will resolve it ASAP 😊.