microsoft / fluentui-system-icons

Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.
https://aka.ms/fluentui-system-icons
MIT License
5.65k stars 498 forks source link

fix: wrapIcon has type error on Ref #648

Closed YuanboXue-Amber closed 9 months ago

YuanboXue-Amber commented 9 months ago

When using wrapIcon to create icon with svg, it can have below error: https://codesandbox.io/s/amazing-cartwright-lwwdyf?file=/example.tsx

image

This is because FluentIconsProps is typed with React.RefAttributes<HTMLElement> and it can't be used on SVG element.

This PR replaced HTMLElement with generic TRefType and set the default to be SVGSVGElement. It ensures the backward compatibility for anyone using HTMLElement ref.