#[TS] Error in my story meta if the component is wrapped in forwardRef

4 messages · Page 1 of 1 (latest)

obtuse harbor
#

Hello, I'm using storybook 7.0.24 i have problem writing story for components wrapped in a forwardRef function. If i remove forward ref TS doesn't fail, if i keep it, then component fail with a TS error

Type 'ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>' is not assignable to type 'ComponentType<ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>> | undefined'.
  Type 'ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>' is not assignable to type 'FunctionComponent<ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>>'.
    Types of property 'propTypes' are incompatible.
      Type 'WeakValidationMap<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>> | undefined' is not assignable to type 'WeakValidationMap<ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>> | undefined'.
        Type 'WeakValidationMap<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>' has no properties in common with type 'WeakValidationMap<ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & RefAttributes<HTMLButtonElement>>>'.ts(2322)

does anyone knows what changed? because in previous versions it was working correctly

warped lagoon
#

@mortal briar Could you jump in?

mortal briar
#

@obtuse harbor Could you make a github issue, with a reproduction? We haven't change any of the types since the 7.0 release.

obtuse harbor
#

it's already on github