Skip to content
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

@defaultValue is not parsed from interface #901

Open
supersnager opened this issue Mar 1, 2024 · 0 comments
Open

@defaultValue is not parsed from interface #901

supersnager opened this issue Mar 1, 2024 · 0 comments

Comments

@supersnager
Copy link

The following code tested in the playgroud https://react-docgen.dev/playground

interface Props {
  /** 
   * The name to greet
   *
   * @defaultValue 'something'
   */
  name: string;
}

/**
 * Hello world component
 */
const MyComponent = (props: Props) => {
  return <div />;
}

returns:

[
  {
    "description": "Hello world component",
    "displayName": "MyComponent",
    "methods": [],
    "props": {
      "name": {
        "required": true,
        "tsType": {
          "name": "string"
        },
        "description": "The name to greet\n\n@defaultValue 'something'"
      }
    }
  }
]

I think the defaultValue property is missing and should appear in the result, and part of the description "@DefaultValue 'something'" should be removed.

[
  {
    "description": "Hello world component",
    "displayName": "MyComponent",
    "methods": [],
    "props": {
      "name": {
        "required": true,
        "tsType": {
          "name": "string"
        },
        "description": "The name to greet",
        "defaultValue": {
          "value": "'something'",
          "computed": false
        }
      }
    }
  }
]

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

No branches or pull requests

1 participant