strothj / react-docgen-typescript-loader

Webpack loader to generate docgen information from Typescript React components.
Other
360 stars 47 forks source link

No default rendered for particular prop #79

Open ffloyd opened 4 years ago

ffloyd commented 4 years ago

Storybook 5.2.8 + React + TypeScript, custom config (no CRA or Next).

Interface:

import React from "react";

import { Button } from "@material-ui/core";

export interface HelloProps {
  /**
   * Text to display
   * @default "just for test"
   */
  text: string;
  /**
   * Event to execute.
   * @default () => {}
   */
  onClick: () => void;
}

const defaultOnClick: HelloProps["onClick"] = () => {};

/** Testing component. */
export const Hello: React.FunctionComponent<HelloProps> = ({
  text,
  onClick = defaultOnClick
}) => (
  <div>
    <Button variant="contained" color="primary" onClick={onClick}>
      {text}
    </Button>
  </div>
);

For the first prop default is rendered, but not for the second one:

Screen Shot 2020-01-05 at 03 38 26

I'm ready to provide more context if this is not enough to reproduce.