hotscript
hotscript copied to clipboard
Building with hotscript as dependency
Hey there! Thanks for the repo, it's very nice, just as your course (passed it and liked a lot!).
We at Evil Martians have plans to extend our nanostores ecosystem with a form library called nanoform. And for it we wanted to make a map store that will provide typesafe object path interface for the underlying structure. That's where we use Objects.Get
and Objects.AllPaths
utilities.
It works perfectly from the DX point of view, but we have an issue when building the lib. It's probably not hotscript specific, but I hoped you could give any guidance on how to fix that.
Here's a repro on StackBlitz. You need to run npm run build
in terminal there. See the problem is that tsc inlines a lot of hotscript code in the .d.ts
file making it unreadable mess.
What's extremely odd is that it does that for one function, getPath
, but not the other, setPath
, even though both use the same set of utility types. Do you have any idea how to get rid of this? Thanks!
It's indeed really weird. Since you are exporting the type it should use the exported type. Can you try to use tsup to generate the build and check if the output is better ?
@ecyrbe The output did change a bit, but somehow to the worse: now it also includes direct imports from hotscript's dist/internals
folder, but the problem didn't go anywhere.
I updated the project to have build:tsup
command.
Can you try but making HOTScript a peerdependency ?
TSUP will include a dep sometimes, even if its only a dev dep but is not marked as a peer dep.
Similar use case here - have buildable library within NX workspace which I may want to publish for other consumers, the types are mess as well.