-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
docgen: fix qualified types with type parameters #61097
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Thank you, I was wondering where this was coming from!
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.
Thank you, @jsnajdr!
I've never worked on the docgen package, but the fix is straightforward.
Size Change: 0 B Total Size: 1.75 MB ℹ️ View Unchanged
|
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.
Great catch @jsnajdr 🚀
@@ -150,7 +150,7 @@ _Parameters_ | |||
|
|||
_Returns_ | |||
|
|||
- `undefined< 'edit' >`: Current user object. | |||
- `ET.User< 'edit' >`: Current user object. |
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.
Nit: Maybe as a follow-up, we could add a clarification of what ET
is. It's nowhere to be found in the doc file.
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.
Yes, the types are currently just names without meaning or explanation. Solving it is a multi-step task. First we need to generate docs also for the @template
type arguments, docs for types, somehow cross-reference them etc.
Fixed a docgen bug that I noticed when reviewing #60988 (comment). If a parameter has "qualified type name" and type parameters, i.e.
X.Y<Z>
, the docgen tool failed to format that type to a string and producedundefined<Z>
.It was a simple omission in the
getTypeReferenceTypeAnnotation
that correctly formattedX.Y
without type parameters but forgot to check for the specialX.Y
syntax when there are type parameters.How to test:
getTypeAnnotation
that checks this case and would fail without the fix.core-data
package -- note how nicely fixed they are now!