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

Documentation: Improve the way types are presented in the generated documentation #17271

Closed
gziolo opened this issue Aug 30, 2019 · 3 comments
Closed
Labels
Needs Dev Ready for, and needs developer efforts [Tool] Docgen /packages/docgen [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.

Comments

@gziolo
Copy link
Member

gziolo commented Aug 30, 2019

Follow-up for #17014.

Related comment from @sirreal https://github.com/WordPress/gutenberg/pull/17014/files#r317982877:

I find the [string] syntax strange. Where does it come from?

I assume it means "optional parameter with a default value", but that only seems to vaguely align with jsdoc, where [square brackets] are used on the parameter or property names to indicate they're optional, not around the type.

To add to the confusion, in TypeScript [ string ] would mean a one-tuple of strings, or an array with a single string member, e.g. [ "foo" ] but never [] or [ "foo", "bar" ].

Response from @dsifford:

Yeah, as it stands, the way that the JSDoc is being parsed definitely results in clunky markdown for this particular case.

In JSDoc, it's pretty easy to tell the difference between optional types and single-tuple types because they are written differently.

// optional string type
/**
 * @param {string} [foo]
 */

// single tuple string type
/**
 * @param {[string]} foo
 */

So I think that you've definitely raised a valid concern with respect to how the docs are being generated.

(PS: syntax comes from here)

@paaljoachim
Copy link
Contributor

Hey Greg @gziolo

I see two merged PR's. Should we close this issue?

@gziolo
Copy link
Member Author

gziolo commented Jan 18, 2021

No, it's still far from perfect.

@gziolo
Copy link
Member Author

gziolo commented Mar 3, 2021

It can be considered done after #28615 was landed.

@gziolo gziolo closed this as completed Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts [Tool] Docgen /packages/docgen [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants