react-docgen
react-docgen copied to clipboard
TS forwardRef support
The following input:
import React, { forwardRef } from 'react';
interface ButtonProps {
variant?: 'small' | 'large';
disabled?: boolean;
children: React.ReactNode;
}
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
{ disabled = false, variant = 'small', children },
ref
) {
return (
<button type="button" disabled={disabled} ref={ref}>
{children} {variant}
</button>
);
});
Produces:
{}
It's come up several times in Storybook: https://github.com/storybookjs/storybook/issues/8894 and https://github.com/storybookjs/storybook/issues/9511
Filed from https://github.com/storybookjs/storybook/pull/24165
I had to turn off docgen in storybook due to this bug. It keeps throwing errors and even my imports get hosed.