simeydotme / svelte-range-slider-pips

Multi-Thumb, Accessible, Beautiful Range Slider with Pips
https://simeydotme.github.io/svelte-range-slider-pips/
Mozilla Public License 2.0
455 stars 42 forks source link

[feature request] Type Declaration Files for TypeScript #69

Open foochris opened 2 years ago

foochris commented 2 years ago

Describe the bug Upon running yarn run check, a hint is outputted stating the a declaration file for the module could not be found

Steps to reproduce the behavior:

  1. Create a Svelte component and add the following line:
    import RangeSlider from 'svelte-range-slider-pips'
  2. Run the command: yarn run check (svelte-check --tsconfig ./tsconfig.json)

Expected behavior

Screenshots

Hint: Could not find a declaration file for module 'svelte-range-slider-pips'. '/node_modules/svelte-range-slider-pips/dist/svelte-range-slider-pips.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/svelte-range-slider-pips` if it exists or add a new declaration (.d.ts) file containing `declare module 'svelte-range-slider-pips';` (ts)
  import Fa from 'svelte-fa'
  import RangeSlider from 'svelte-range-slider-pips'

Device/Environtment

Additional context

simeydotme commented 2 years ago

hi @foochris am I right in assuming you're filing a issue because you're trying to build a TypeScript project and include this JavaScript module, and then when your TypeScript project runs a status check, it warns you that there's no TypeScript declaration for this JavaScript module?

If you know how, and want to add a type declaration file to this project, I'd be happy to entertain a Merge Request (pull request), so long as you put a type declaration test in the /test/ folder, as well. I will not be adding TypeScript code myself to this project, though.

Thanks

orefalo commented 2 years ago

Found this issue as the problem showed up on https://github.com/orefalo/svelte-splitpanes

An easy way to get this project typed, it to convert the code to typescript. It's relatively trivial for an existing (well written) JS project.

markjaquith commented 1 year ago

🎊 Someone submitted typing for this project to DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/62994

💡 You can now do npm i -D @types/svelte-range-slider-pips