Skip to content

fix: find TS props of classes extending a mixin call - #1145

Open
mfazekas wants to merge 1 commit into
reactjs:mainfrom
rnmapbox:upstream/extends-hoc-props
Open

mfazekas wants to merge 1 commit into
reactjs:mainfrom
rnmapbox:upstream/extends-hoc-props

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Class components built with the TypeScript mixin pattern get no props:

interface Props {
  /** description of value */
  value: string;
}

class MyComponent extends withFoo(React.Component<Props>) {
  render() { return <div />; }
}

The props type lives in the type arguments of the base class passed to the mixin, so neither superTypeParameters nor a props class property finds it. When the superclass is a call whose first argument is an instantiation expression (React.Component<Props>), its first type argument is used as the props type. Otherwise the existing props property lookup still applies.

Before: props is empty. After: value is documented as a required string with its description.

@changeset-bot

changeset-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ebbf75c

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 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for react-docgen ready!

Name Link
🔨 Latest commit ebbf75c
🔍 Latest deploy log https://app.netlify.com/projects/react-docgen/deploys/6ad892a58a70102a2fa15751
😎 Deploy Preview https://deploy-preview-1145--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.

1 participant