janosh / svelte-toc

Sticky responsive table of contents component
https://janosh.github.io/svelte-toc
MIT License
112 stars 6 forks source link

[Question]TypeScript support #42

Closed lym8356 closed 1 year ago

lym8356 commented 1 year ago

Hi, does this library support TypeScript?

I am getting errors when I import this library in my TypeScript project.

janosh commented 1 year ago

Yes, TS is supported. Could you be more specific? What error are you seeing?

lym8356 commented 1 year ago

It says "Cannot find module 'svelte-toc' or its corresponding type declarations." I have seen this error before when I tried to use a package that does not support typescript, or I forgot to install its @type package.

janosh commented 1 year ago

Sounds like it might be the same problem as https://github.com/janosh/svelte-multiselect/issues/233. If so, the recommended solution is also the same. Either update to typescript v5 and set your module resolution to "bundler" or downgrade to before this package version migrated to svelte-package v2.

lym8356 commented 1 year ago

After I set my module resolution to bundler, it is working without problem. Thank you for your help!