-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add functionality to export doc strings on struct fields and enum variants #229
Conversation
I would like to ask for your help @escritorio-gustavo to solve these issues 🙏
Should we create a new I believe there is no way to refactor the usage of |
(the commit message "exporting docs on struct fields not works" should of course be "now works", lol) |
Good question, I assume they currently don't export the docs right? I think we can skip documenting fields for these types as documenting the field of a newtype is kinda pointless and I'm not sure if TSDoc even renders tuple member documentation
Sure, I'll write some tests and push them to the PR
That could work, but we need to check with @NyxCode. It's really annoying that we can't just move the function to |
macros/src/types/newtype.rs
Outdated
@@ -29,6 +29,7 @@ pub(crate) fn newtype( | |||
skip, | |||
optional, | |||
flatten, | |||
docs: _, // TODO: Not sure what to do here with docs yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think discarding is the right thing to do, documenting the field of a newtype seems pointless to me, just document the type itself
I think we can make |
Wonderful! Thanks for all the help! 🤝🏽 |
This is an "extension" of #187 and tries to also export doc strings not only on "full types" but also on the fields/variants of structs/enums.
This is also a new PR as a replacement for #228, because that PR had a "wrong commit base".
Example
is exported as (with
format
feature)and
is exported as (with
format
feature)Notes
These are the "problems" that have to be thought of.
Following notes are a combination of my own observations + input from @escritorio-gustavo.
JSDocs are only shown when starting in a new line (solved)
Inserted doc strings always have a leading newline to solve this.
JSDocs are not applicable to unions (enums)
See microsoft/tsdoc#164
It seems like this is currently not possible, not even depending on the tagging-kind of enums.