flekschas / svelte-simple-modal

A simple, small, and content-agnostic modal for Svelte v3 and v4
https://svelte.dev/repl/b95ce66b0ef34064a34afc5c0249f313
MIT License
422 stars 30 forks source link

Type definition for `bind` seems incorrect #70

Closed hhhapz closed 2 years ago

hhhapz commented 2 years ago

image

Following the readme's example, I tried using the bind function, however I get this warning. Further digging seems to lead me to believe that the source of problem comes from the type definition for the bind function to be incorrect.

flekschas commented 2 years ago

Which version are you using?

williharder commented 2 years ago

have the same issue on version 1.3.1.

dustinc commented 2 years ago

Looks like bind is an instance of Modal instead of the bind function. Importing from src fixes the issue for me.. though does feel slightly wrong to have to do: import { bind } from 'svelte-simple-modal/src'

flekschas commented 2 years ago

If you want to take a stab at it, the type annotation is https://github.com/flekschas/svelte-simple-modal/blob/master/src/Modal.svelte#L4 and it's being translated into the type definition using sveld during the build. It looks like the type def is translated correctly but maybe it's not, or something else is off.

dustinc commented 2 years ago

@flekschas I'll try to take a look at it this week. Overall, this is a very handful package! Thanks

flekschas commented 2 years ago

Fixed via 17663ad36c33c6292f442cce4518a414c64a80d4. If the issue still persist, please reopen.