-
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: Find parameters by index rather than name and handle array destructuring #29945
Conversation
Size Change: +1.07 kB (0%) Total Size: 1.42 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.
Looking really good, nice work!
packages/docgen/test/fixtures/type-annotations/array-destructuring-any-other-type/example.ts
Show resolved
Hide resolved
@@ -19,7 +22,7 @@ describe( 'Type annotations', () => { | |||
type: 'number', | |||
}; | |||
const node = {}; | |||
const result = getTypeAnnotation( tag, node ); | |||
const result = getTypeAnnotation( tag, node, 0 ); |
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.
What do you think about making the default param for index be 0? (Or maybe it makes more sense to just be explicit, idk)
1e9391a
to
a8a0b12
Compare
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.
Assuming that docgen is still working well (not sure how to test that myself), this looks good to me!
Thanks @noahtallen! FWIW the best way to test docgen is to run |
Description
See the solution proposed in #29944. This PR implements that solution.
Partially fixes #29944 for array destructuring but not for object destructuring. Object destructuring will happen in a separate PR to reduce the size of the PRs.
How has this been tested?
npm run docs:build
should have no changes (docs continue to build successfully as they were before).Types of changes
Bug fix.
Checklist: