react-docgen-typescript-loader
react-docgen-typescript-loader copied to clipboard
No default rendered for particular prop
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:
I'm ready to provide more context if this is not enough to reproduce.