babichjacob / svelte-localstorage

Svelte writable stores that automatically synchronize with localStorage
MIT License
46 stars 1 forks source link

Exporting of TypeScript types? #22

Open danawoodman opened 2 years ago

danawoodman commented 2 years ago

Is there plans to export the TS types for this package? I see there is some typing in the source, but when consuming the package in SvelteKit, the types aren't making their way over.

babichjacob commented 2 years ago

The types are definitely supposed to be exported. I was able to see them when developing in the demo app, for instance. I have to look into this

danawoodman commented 2 years ago

Thanks for the quick reply @babichjacob, this is what I see in a fairly new Kit project:

image

danawoodman commented 2 years ago

@babichjacob any luck with this?

babichjacob commented 2 years ago

Sorry for the delay. I just found out that you can get the types and JSDoc hints to work in TypeScript projects by adding "maxNodeModuleJsDepth": 1 in compilerOptions in tsconfig.json. (allowJs is reportedly also needed but that is included by default in SvelteKit apps, and I didn't see a difference in testing).

This isn't amazing, so I might have to look into another solution from the library's side instead of consumer's.

babichjacob commented 2 years ago

This has been added to the README in 2ae719cfc71b720cf6e61f55ed82a0c1e17dc4e3.