Closed seanlail closed 2 years ago
Hey @seanlail, thanks for opening this issue/request. Glad to hear this tool is useful! 🙂
I'd like to keep exports to a minimum to reduce clutter in auto-complete results. That being said, Slices and a few of their internal types, such as their items
field interface should be exported but currently are not.
Types for Shared Slices have have been exported, but "legacy" Slices (those embedded in a Custom Type) erroneously have not not been.
I made some changes in #10 that hopefully exports what you need. If it does not do what you're looking for, please me know (or feel free to open a PR) and I'll take a look.
Thanks for your input! Feel free to suggest other improvements - I really appreciate it. 🙂
The fix has been published in v0.0.3
. 🎉
To upgrade, install the latest version and re-generate your types:
npm install prismic-ts-codegen@latest
npx prismic-ts-codegen
@angeloashmore Thanks for the quick response and all your work!
Completely agree with reducing the clutter.
Oh I didn't realise that Slices in a Custom Type is the "old" way. I'll look at Shared Slices now. Thanks :)
Is your feature request related to a problem? Please describe.
This is great! Just what I was looking for.
I have a small issue though: When generating the types, only the document type is exported. All the other nested types are not exported.
When I want to create a component for a slice I can't access the type for that slice directly. I think this would be an issue for anyone using the types, regardless of framework / tool.
Describe the solution you'd like
I'm sure it should be easy enough to export the Slices. Perhaps the code completion might be confusing? A possible clearer way might be to split up the types. e.g. by document? (that may be a bit difficult to do though)
Describe alternatives you've considered
I can manually run an additional script to add "export " to every line with type or interface.
Additional context
I'm happy to create a PR for this. Just want to verify this is a good idea.