Skip to content
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

JS private identifiers are included in the generated documentation #45

Closed
bryan-hoang opened this issue Dec 16, 2024 · 2 comments · Fixed by #46, #47 or #48
Closed

JS private identifiers are included in the generated documentation #45

bryan-hoang opened this issue Dec 16, 2024 · 2 comments · Fixed by #46, #47 or #48

Comments

@bryan-hoang
Copy link

bryan-hoang commented Dec 16, 2024

Documentation for private class methods defined using private identifier syntax (i.e., #privateMethod() {}) is always emitted, despite being private at runtime.

To Reproduce

See https://github.com/bryan-hoang/repro-tsdoc-markdown-private-identifiers

Expected behavior

I expected the documentation to be omitted, like how it is for private methods declared using the private keyword.

Additional context

To work around the issue, I have to switch to using the private keyword.

I took a quick glance at how the visibility for the documented symbol is determined in src/lib/docs.ts#146. Based on Typescript AST Viewer 1, checking for PrivateIndentifier seems to be the way to go, although I'm not familiar enough with the compiler's API to know how difficult it would be to add the check.

Footnotes

  1. https://ts-ast-viewer.com/#code/KYDwDg9gTgLgBAYwDYEMDOa4BlgBMDmwUAwigHYCWaMRcA3gFACQA9AFRvNxtwAKUFAG4oacCrmBkYFAGYVaAW2AwAFhFwA6LjwACYAcJraWzAMRo1AVyS4AchABCwACIQElpVLwAKAJT1mJgQIMjQIJGANJAh8bwByFWAkaLjfAG5mAF8GZnZOJm4+AxFgOCVVdS0C3X0hEuNmWsNSiwhrO0cXNw9JGlw-AKYgkLCIqJj4xOSIVIymbOygA

@peterpeterparker
Copy link
Owner

Good catch! The private identifier syntax was indeed being generated, and I also noticed that the inner properties of classes weren’t being generated either. I resolved both issues this evening and released a new version of the library, v1.1.0.

@bryan-hoang
Copy link
Author

Thank you @peterpeterparker!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants