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

Type checking disable for whileDrag #24

Open
dtsmarin opened this issue Sep 2, 2022 · 1 comment
Open

Type checking disable for whileDrag #24

dtsmarin opened this issue Sep 2, 2022 · 1 comment

Comments

@dtsmarin
Copy link

dtsmarin commented Sep 2, 2022

I'm getting a type error because I'm trying to use a function inside whileDrag

 whileDrag={handleTouch}
Type '() => void' is not assignable to type 'VariantLabels | TargetAndTransition'.

The code works fine and does exactly what I need though. Execute a function while the object is being dragged.

Is there any way to disable this type checking?

I'm using Svelte with Vite.

@micha-lmxt
Copy link
Owner

I'm happy when it works for you, but usually 'whileDrag' is not supposed to accept callback. I am somewhat surprised, that it kind of works. I tested myself, it seems the 'whileDrag' is called once the drag starts and once when it is done, both times without any argument.

'onDrag' accepts a callback and is called over and over while dragged.

If you just want to silence Typescript you could cast your handler to 'any'
const handleTouch : any = ()=>{...}

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