Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

FAB should also extend React.ButtonHTMLAttributes #660

Closed
@mgr34

Description

@mgr34

While working on a PR for an exited prop (#658) I wanted to pass an onClick handler to toggle exit value. However, since FAB was not extending React.ButtonHTMLAttributes I was unable to pas sonClick. This also extended to other attributes you may find on a button. E.g. title, name, or type.

error msg when including name

      TS2322: Type '{ exited: boolean; mini: true; icon: Element; name: string; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<withRipple<FabProps, HTMLButtonElement, Element>.RippledComponent> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Pick<...> & RippledComponentProps<...>>, "children" | ... 3 more ... | "textLabel"> & Partial<...> & Partial<...>'.
  Property 'name' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<withRipple<FabProps, HTMLButtonElement, Element>.RippledComponent> & Pick<Readonly<{ children?: ReactNode; }> & Readonly<Pick<...> & RippledComponentProps<...>>, "children" | ... 3 more ... | "textLabel"> & Partial<...> & Partial<...>'. 

Changing

export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement> {}

TO

export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement>, React.ButtonHTMLAttributes<HTMLButtonElement> {}

resolves the error message. Might there be a better solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions