Skip to content

Conversation

DiogoDoreto
Copy link
Contributor

Extend the resolveName function in getMemberExpressionValuePath.ts to handle ObjectMethod nodes, preventing the error below from being thrown during AST resolution of member expressions within object methods.

TypeError: Attempted to resolveName for an unsupported path. resolveName does not accept ObjectMethod.

Fix #902


Since I faced the exact same error as the one reported on the issue above in our project, I managed to pin point the place where the error was happening and created a minimal test that reproduce the scenario.

Copy link

changeset-bot bot commented Oct 8, 2025

🦋 Changeset detected

Latest commit: d27b6bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
react-docgen Patch
@react-docgen/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Oct 8, 2025

Deploy Preview for react-docgen ready!

Name Link
🔨 Latest commit d27b6bc
🔍 Latest deploy log https://app.netlify.com/projects/react-docgen/deploys/68e6d11a61574900085a1c4c
😎 Deploy Preview https://deploy-preview-1036--react-docgen.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Extend the resolveName function in getMemberExpressionValuePath.ts to
handle ObjectMethod nodes, preventing the error below from being thrown
during AST resolution of member expressions within object methods.

TypeError: Attempted to resolveName for an unsupported path. resolveName does not accept ObjectMethod.

Fix reactjs#902
@danez
Copy link
Collaborator

danez commented Oct 8, 2025

I did some more testing and turns out we simply have to ignore ObjectMethod in this function and not resolve any name. Thanks for the PR

@danez danez merged commit a122bff into reactjs:main Oct 8, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Attempted to resolveName for an unsupported path" error
2 participants