Skip to content

The description of extended Props is not output correctly #997

@haitru6458

Description

@haitru6458

I created FooProps by extending BarProps, but the description of FooProps is not used; instead, the description of BarProps is adopted.

Input

export interface BarProps {
  /** BarProps param1 */
  param1: any;
}

export interface FooProps extends BarProps {
  /** FooProps param1 */
  param1: string;
  /** FooProps param2 */
  param2: string;
}

export const Foo = (props: FooProps) => {
  return <div>foo</div>;
};

output

{
  "./src/foo.tsx": [
    {
      "description": "",
      "methods": [],
      "displayName": "Foo",
      "props": {
        "param1": {
          "required": true,
          "tsType": {
            "name": "string"
          },
          "description": "BarProps param1"
        },
        "param2": {
          "required": true,
          "tsType": {
            "name": "string"
          },
          "description": "FooProps param2"
        }
      }
    }
  ]
}

The props.param1.description should be "FooProps param1" instead of "BarProps param1".

Tested on @react-docgen/cli@3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions