Skip to content

Commit 49e33f0

Browse files
committed
fixup! Clean up "Actions" generic types
Remove unwanted type parameter defaults
1 parent 1dcbbfb commit 49e33f0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

packages/compass-components/src/components/actions/item-action-button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ItemActionButtonSize } from './constants';
55
import type { ItemComponentProps } from './types';
66
import { SmallIconButton } from './small-icon-button';
77

8-
export function ItemActionButton({
8+
export function ItemActionButton<Action extends string>({
99
action,
1010
icon = <></>,
1111
label,
@@ -17,7 +17,7 @@ export function ItemActionButton({
1717
iconStyle,
1818
isDisabled,
1919
'data-testid': dataTestId,
20-
}: ItemComponentProps) {
20+
}: ItemComponentProps<Action>) {
2121
return (
2222
<SmallIconButton
2323
key={action}

packages/compass-components/src/components/actions/item-action-controls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export type ItemActionControlsProps<Action extends string> = {
3333
'data-testid'?: string;
3434
};
3535

36-
export function ItemActionControls<Action extends string = string>({
36+
export function ItemActionControls<Action extends string>({
3737
isVisible = true,
3838
actions,
3939
onAction,

packages/compass-components/src/components/actions/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { glyphs } from '@leafygreen-ui/icon';
22

33
import type { ItemActionButtonSize } from './constants';
44

5-
export type ItemBase<Action extends string = string> = {
5+
export type ItemBase<Action extends string> = {
66
action: Action;
77
label: string;
88
icon?: React.ReactChild;
@@ -18,7 +18,7 @@ export type ItemBase<Action extends string = string> = {
1818
expandedAs?: React.ComponentType<ItemComponentProps<Action>>;
1919
};
2020

21-
export type ItemComponentProps<Action extends string = string> = Omit<
21+
export type ItemComponentProps<Action extends string> = Omit<
2222
ItemBase<Action>,
2323
'expandedAs'
2424
> & {
@@ -31,7 +31,7 @@ export type ItemComponentProps<Action extends string = string> = Omit<
3131
setHidable?(hidable: boolean): void;
3232
};
3333

34-
export type ItemAction<Action extends string = string> = {
34+
export type ItemAction<Action extends string> = {
3535
icon: keyof typeof glyphs | React.ReactElement;
3636
} & ItemBase<Action>;
3737

packages/compass-connections-navigation/src/connect-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function ConnectMenuItem({ action, glyph, ...rest }: ConnectMenuItemProps) {
3535
// Hack to make SplitButton consider this as a MenuItem
3636
ConnectMenuItem.displayName = 'MenuItem';
3737

38-
type ConnectButtonProps = ItemComponentProps;
38+
type ConnectButtonProps = ItemComponentProps<Actions>;
3939

4040
export function ConnectButton({
4141
setHidable,

0 commit comments

Comments
 (0)