svelte-localstorage icon indicating copy to clipboard operation
svelte-localstorage copied to clipboard

Exporting of TypeScript types?

Open danawoodman opened this issue 3 years ago • 5 comments

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.

danawoodman avatar Aug 02 '22 20:08 danawoodman

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

babichjacob avatar Aug 02 '22 21:08 babichjacob

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

image

danawoodman avatar Aug 02 '22 21:08 danawoodman

@babichjacob any luck with this?

danawoodman avatar Aug 22 '22 17:08 danawoodman

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 avatar Sep 05 '22 16:09 babichjacob

This has been added to the README in 2ae719cfc71b720cf6e61f55ed82a0c1e17dc4e3.

babichjacob avatar Sep 05 '22 17:09 babichjacob