Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface-Definitions: All Methods return void #18

Open
leoonhitgub opened this issue Aug 27, 2024 · 2 comments
Open

Interface-Definitions: All Methods return void #18

leoonhitgub opened this issue Aug 27, 2024 · 2 comments

Comments

@leoonhitgub
Copy link

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
Copy link
Author

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
Copy link
Owner

selemondev commented Aug 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants