@@ -38,7 +38,8 @@ import { RadioBox, RadioBoxGroup } from '@leafygreen-ui/radio-box-group';
3838import { Radio , RadioGroup } from '@leafygreen-ui/radio-group' ;
3939import {
4040 SegmentedControl ,
41- SegmentedControlOption ,
41+ SegmentedControlOption as LGSegmentedControlOption ,
42+ type SegmentedControlOptionProps ,
4243} from '@leafygreen-ui/segmented-control' ;
4344import { Select , Option , OptionGroup } from '@leafygreen-ui/select' ;
4445import {
@@ -85,36 +86,27 @@ import {
8586 Overline as LGOverline ,
8687 Label as LGLabel ,
8788 Description as LGDescription ,
89+ type LabelProps ,
90+ type H1Props ,
91+ type H2Props ,
92+ type H3Props ,
93+ type SubtitleProps ,
94+ type BodyProps ,
95+ type OverlineProps ,
96+ type DescriptionProps ,
8897} from '@leafygreen-ui/typography' ;
8998
90- function createPolymorphicWrapper < T extends React . ElementType = any > (
91- Component : React . ComponentType < any > ,
92- displayName ?: string
93- ) {
94- const WrappedComponent = React . forwardRef ( ( props : any , ref : any ) => {
95- return React . createElement ( Component , { ...props , ref } ) as JSX . Element ;
96- } ) ;
97-
98- WrappedComponent . displayName = displayName ;
99-
100- return WrappedComponent as typeof Component ;
101- }
102- // @ts -expect-error sorry, LG needs to fix it's types
103- const H1 = createPolymorphicWrapper ( LGH1 , 'H1' ) ;
104- // @ts -expect-error sorry, LG needs to fix it's types
105- const H2 = createPolymorphicWrapper ( LGH2 , 'H2' ) ;
106- // @ts -expect-error sorry, LG needs to fix it's types
107- const H3 = createPolymorphicWrapper ( LGH3 , 'H3' ) ;
108- // @ts -expect-error sorry, LG needs to fix it's types
109- const Subtitle = createPolymorphicWrapper ( LGSubtitle , 'Subtitle' ) ;
110- // @ts -expect-error sorry, LG needs to fix it's types
111- const Body = createPolymorphicWrapper ( LGBody , 'Body' ) ;
112- // @ts -expect-error sorry, LG needs to fix it's types
113- const Overline = createPolymorphicWrapper ( LGOverline , 'Overline' ) ;
114- // @ts -expect-error sorry, LG needs to fix it's types
115- const Label = createPolymorphicWrapper ( LGLabel , 'Label' ) ;
116- // @ts -expect-error sorry, LG needs to fix it's types
117- const Description = createPolymorphicWrapper ( LGDescription , 'Description' ) ;
99+ // Workaround until https://jira.mongodb.org/browse/LG-5354 is resolved
100+ const H1 = LGH1 as React . FC < H1Props > ;
101+ const H2 = LGH2 as React . FC < H2Props > ;
102+ const H3 = LGH3 as React . FC < H3Props > ;
103+ const Subtitle = LGSubtitle as React . FC < SubtitleProps > ;
104+ const Body = LGBody as React . FC < BodyProps > ;
105+ const Overline = LGOverline as React . FC < OverlineProps > ;
106+ const Description = LGDescription as React . FC < DescriptionProps > ;
107+ const Label = LGLabel as React . FC < LabelProps > ;
108+ const SegmentedControlOption =
109+ LGSegmentedControlOption as React . FC < SegmentedControlOptionProps > ;
118110
119111import {
120112 Combobox ,
0 commit comments