html5sortable icon indicating copy to clipboard operation
html5sortable copied to clipboard

Import fails with Astro Build

Open goldenratio opened this issue 1 year ago • 3 comments

Describe the bug Unable to use import state with Astro build https://astro.build/

To Reproduce Steps to reproduce the behavior:

  import sortable from 'html5sortable';

Getting following error, run npm run build

error ts(7016): Could not find a declaration file for module 'html5sortable'. 'C:/Projects/foler_name/node_modules/html5sortable/dist/html5sortable.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/html5sortable` if it exists or add a new declaration (.d.ts) file containing `declare module 'html5sortable';`

32   import sortable from 'html5sortable';
                          ~~~~~~~~~~~~~~~


Expected behavior import should work

goldenratio avatar Dec 21 '23 10:12 goldenratio

This repo does not currently have typescript typings and will probably not get them soon.

This is not an astro issue, but rather a typescript one I think.

lukasoppermann avatar Jun 10 '24 12:06 lukasoppermann

@lukasoppermann why don't we have typescript typing support? The code is 97% typescript.

Genuine question, as I've never written a library and don't know how types are exported.

clmnin avatar Jun 12 '24 14:06 clmnin

@clmnin I think the main issue is that this is not typed: https://github.com/lukasoppermann/html5sortable/blob/master/src/html5sortable.ts

97% is only because of the .ts ending. However this does not mean that all those files have correct type annotations.

Feel free to add a PR with typings for https://github.com/lukasoppermann/html5sortable/blob/master/src/html5sortable.ts to make this work better.

lukasoppermann avatar Jun 12 '24 14:06 lukasoppermann