Skip to content

Ref is working with icons, but is not present on Icon type #78

@filingroove

Description

@filingroove

I'm moving a project to TypeScript and I can't use ref :)

The code:

<Info size={ 14 } color="#BDC1C7" ref={ infoIcon } />

The compiler error:

Type error: Type '{ size: number; color: string; ref: MutableRefObject<SVGElement>; }' is not assignable to type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
  Property 'ref' does not exist on type 'IntrinsicAttributes & Props & { children?: ReactNode; }'. Did you mean 'href'?

Not sure what type to use for forwardRef function component, but seems like FC doesn't include any ref property 🤔

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