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

TS forwardRef support

Open shilman opened this issue 1 year ago • 1 comments

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

shilman avatar Nov 30 '23 14:11 shilman

I had to turn off docgen in storybook due to this bug. It keeps throwing errors and even my imports get hosed.

UTGuy avatar Dec 07 '23 23:12 UTGuy