Skip to content

Commit 2a1ad74

Browse files
committed
simpler workaround
1 parent dde0666 commit 2a1ad74

File tree

11 files changed

+37
-40
lines changed

11 files changed

+37
-40
lines changed

packages/compass-components/src/components/leafygreen.tsx

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ import { RadioBox, RadioBoxGroup } from '@leafygreen-ui/radio-box-group';
3838
import { Radio, RadioGroup } from '@leafygreen-ui/radio-group';
3939
import {
4040
SegmentedControl,
41-
SegmentedControlOption,
41+
SegmentedControlOption as LGSegmentedControlOption,
42+
type SegmentedControlOptionProps,
4243
} from '@leafygreen-ui/segmented-control';
4344
import { Select, Option, OptionGroup } from '@leafygreen-ui/select';
4445
import {
@@ -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

119111
import {
120112
Combobox,

packages/compass-data-modeling/src/components/diagram-card.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ export function DiagramCard({
100100
<Subtitle
101101
as="div"
102102
className={cx(cardTitle, darkmode ? cardTitleDark : cardTitleLight)}
103-
title={diagram.name}
104103
>
105104
{diagram.name}
106105
</Subtitle>

packages/compass-generative-ai/src/components/ai-feedback.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ type AIFeedbackProps = {
8080
function AIFeedback({ onSubmitFeedback }: AIFeedbackProps) {
8181
const darkMode = useDarkMode();
8282

83-
const feedbackPositiveButtonRef = useRef<HTMLInputElement>(null);
84-
const feedbackNegativeButtonRef = useRef<HTMLInputElement>(null);
83+
const feedbackPositiveButtonRef = useRef<HTMLButtonElement>(null);
84+
const feedbackNegativeButtonRef = useRef<HTMLButtonElement>(null);
8585

8686
const [chosenFeedbackOption, setChosenFeedbackOption] = useState<
8787
'none' | 'positive' | 'negative'

packages/compass-global-writes/src/store/reducer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,8 @@ export const createShardKey = (
625625

626626
// Exporting this for test only to stub it and set
627627
// its value. This enables to test cancelShardingaction.
628-
export const showConfirmation = showConfirmationModal;
628+
export const showConfirmation: typeof showConfirmationModal =
629+
showConfirmationModal;
629630

630631
export const cancelSharding = (): GlobalWritesThunkAction<
631632
Promise<void>,

packages/compass-indexes/src/modules/regular-indexes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ const failedIndexRemoved = (
620620

621621
// Exporting this for test only to stub it and set
622622
// its value. This enables to test dropIndex action.
623-
export const showConfirmation = showConfirmationModal;
623+
export const showConfirmation: typeof showConfirmationModal =
624+
showConfirmationModal;
624625

625626
export const dropFailedIndex = (
626627
indexName: string

packages/compass-indexes/src/modules/search-indexes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ export const pollSearchIndexes = (): IndexesThunkAction<
653653

654654
// Exporting this for test only to stub it and set
655655
// its value. This enables to test dropSearchIndex action.
656-
export const showConfirmation = showConfirmationModal;
656+
export const showConfirmation: typeof showConfirmationModal =
657+
showConfirmationModal;
657658

658659
export const dropSearchIndex = (
659660
name: string

packages/compass-saved-aggregations-queries/src/components/saved-item-card.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ export const SavedItemCard: React.FunctionComponent<
229229
<Subtitle
230230
as="div"
231231
className={cx(cardName, darkMode ? cardNameDark : cardNameLight)}
232-
title={name}
233232
>
234233
{name}
235234
</Subtitle>

packages/compass-sidebar/src/components/connections-filter-popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function ConnectionsFilterPopover({
9191
>
9292
Filter connections
9393
</Tooltip>
94-
<InteractivePopover
94+
<InteractivePopover<HTMLButtonElement>
9595
open={open}
9696
setOpen={setOpen}
9797
containerClassName={containerStyles}

packages/compass-telemetry/src/telemetry-events.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2709,7 +2709,8 @@ type ScreenEvent = ConnectionScopedEvent<{
27092709
| 'shell_info_modal'
27102710
| 'update_search_index_modal'
27112711
| 'end_of_life_mongodb_modal'
2712-
| 'export_diagram_modal';
2712+
| 'export_diagram_modal'
2713+
| `${string}_search_index_modal`;
27132714
};
27142715
}>;
27152716

packages/compass-welcome/src/components/web-welcome-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function WebWelcomeTab() {
4242
{numConnections === 0 && (
4343
<>
4444
<Button
45-
as={Link}
45+
as={'a'}
4646
data-testid="add-new-atlas-cluster-button"
4747
variant={ButtonVariant.Primary}
4848
href={'#/clusters/starterTemplates'}

0 commit comments

Comments
 (0)