Repository navigation
fix(icon)!: type the source prop as IconSource - #5212
Conversation
BREAKING CHANGE: Icon's source prop is typed as IconSource instead of any, so a value that isn't an icon name, an image source or a render function no longer type-checks.
|
Found potential problems with the pull request:
|
|
@Doberjohn Nice change. Nothing blocks the merge. These are nits:
|
|
Thanks for the review, 41e24b5 addresses 1, 4 and 5:
I left 2 and 3 as they are. For 2, both guards behave the same, since |
Motivation
Icon's publicsourceprop was typedany, so it accepted anything. Typing it asIconSourceshowed what that hid: render functions getdirectionandtestID, which the type didn't list, andIconpasseddirection: nullwhere the types and the icons guide say'ltr'or'rtl'. It now passes'ltr', which renders the same.Related issue
None. #5194 (on 6.1.0) exports
IconSourcefrom the package root separately.Screenshots / Videos
No UI change
Test plan
yarn typecheck,yarn lintandyarn testpass. New tests: a boolean orundefinedsource renders nothing and is a@ts-expect-error, and render functions get'ltr'. The BottomNavigation custom icon tests now render icons.