react-docgen-typescript-loader icon indicating copy to clipboard operation
react-docgen-typescript-loader copied to clipboard

No default rendered for particular prop

Open ffloyd opened this issue 5 years ago • 0 comments
trafficstars

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.

ffloyd avatar Jan 05 '20 00:01 ffloyd