Skip to content

Commit b0b39ad

Browse files
committed
further ts fixes
1 parent e213e29 commit b0b39ad

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

packages/compass-components/src/components/actions/small-icon-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ export const SmallIconButton = forwardRef<
4848
) {
4949
return (
5050
<IconButton
51-
// eslint-disable-next-line @typescript-eslint/ban-ts-comments
5251
ref={ref}
5352
className={cx(buttonSizeStyle[size], className)}
5453
aria-label={label}
5554
title={title}
5655
onClick={onClick}
5756
{...rest}
57+
as={undefined} // HTMLButtonElement.as doesn't match the type
5858
>
5959
<span role="presentation" className={iconContainerStyle}>
6060
<ActionGlyph glyph={glyph} size={size} />

packages/compass-components/src/components/links/link.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useContext, forwardRef, useMemo } from 'react';
22
import { Link as LGLink } from '@leafygreen-ui/typography';
3-
import LGButton from '@leafygreen-ui/button';
4-
import LGIconButton from '@leafygreen-ui/icon-button';
3+
import LGButton, { type ButtonProps } from '@leafygreen-ui/button';
4+
import LGIconButton, { type IconButtonProps } from '@leafygreen-ui/icon-button';
55

66
type RequiredURLSearchParamsContextValue = {
77
utmSource?: string;
@@ -75,20 +75,20 @@ export const Link = (({ href, children, ...rest }: LeafygreenLinkProps) => {
7575
// eslint-disable-next-line react/display-name
7676
export const Button = forwardRef(
7777
(
78-
{ href, children, ...rest }: React.ComponentProps<typeof LGButton>,
78+
{ children, ...props }: ButtonProps,
7979
ref: React.ForwardedRef<HTMLButtonElement>
8080
) => {
8181
const { utmSource, utmMedium } = useRequiredURLSearchParams();
8282

8383
const hrefWithParams = useMemo(() => {
84-
if (href) {
85-
return urlWithUtmParams(href, { utmSource, utmMedium });
84+
if ('href' in props && props.href) {
85+
return urlWithUtmParams(props.href, { utmSource, utmMedium });
8686
}
8787
return undefined;
88-
}, [href, utmSource, utmMedium]);
88+
}, [props, utmSource, utmMedium]);
8989

9090
return (
91-
<LGButton href={hrefWithParams} {...rest} ref={ref}>
91+
<LGButton {...props} href={hrefWithParams} ref={ref}>
9292
{children}
9393
</LGButton>
9494
);
@@ -98,20 +98,20 @@ export const Button = forwardRef(
9898
// eslint-disable-next-line react/display-name
9999
export const IconButton = forwardRef(
100100
(
101-
{ href, children, ...rest }: React.ComponentProps<typeof LGIconButton>,
101+
{ children, ...props }: IconButtonProps,
102102
ref: React.ForwardedRef<HTMLAnchorElement>
103103
) => {
104104
const { utmSource, utmMedium } = useRequiredURLSearchParams();
105105

106106
const hrefWithParams = useMemo(() => {
107-
if (href) {
108-
return urlWithUtmParams(href, { utmSource, utmMedium });
107+
if ('href' in props && props.href) {
108+
return urlWithUtmParams(props.href, { utmSource, utmMedium });
109109
}
110110
return undefined;
111-
}, [href, utmSource, utmMedium]);
111+
}, [props, utmSource, utmMedium]);
112112

113113
return (
114-
<LGIconButton href={hrefWithParams} {...rest} ref={ref}>
114+
<LGIconButton href={hrefWithParams} {...props} ref={ref}>
115115
{children}
116116
</LGIconButton>
117117
);

0 commit comments

Comments
 (0)