Skip to content

fix: preserve indexed access type details - #1149

Open
blueDaydreaming725 wants to merge 1 commit into
reactjs:mainfrom
blueDaydreaming725:fix/906-indexed-access-details
Open

blueDaydreaming725 wants to merge 1 commit into
reactjs:mainfrom
blueDaydreaming725:fix/906-indexed-access-details

Conversation

@blueDaydreaming725

Copy link
Copy Markdown

Summary

Fixes #906.

Props typed through indexed access, such as Base['size'], currently retain the resolved type name but lose its details. This preserves union members and nested object signatures by copying the already resolved type instead of reconstructing only its name.

The indexed expression remains the raw value. The source property's top-level required flag is excluded, so it does not leak into the indexed type; nested property flags remain intact. Reusing the resolved descriptor also avoids a separate indexed-access parser.

Validation

  • Both new union/object regression tests failed before the fix.
  • Full react-docgen library suite: 1,447 tests passed.
  • Package build/typecheck and changed-file ESLint passed.
  • Independent validation through built-library parse() covered union members, nested signatures and required flags; independent code review passed.

Website and CLI package suites were not run.

@changeset-bot

changeset-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 59704ff

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

@netlify

netlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for react-docgen ready!

Name Link
🔨 Latest commit 59704ff
🔍 Latest deploy log https://app.netlify.com/projects/react-docgen/deploys/6adafb64d1a7c8f23a72cc92
😎 Deploy Preview https://deploy-preview-1149--react-docgen.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

This branch has not been deployed

No deployments
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.

TypeScript: Missing Union Elements of Indexed Access Type

1 participant