diff --git a/packages/core-components/src/components/EmptyState/EmptyState.test.tsx b/packages/core-components/src/components/EmptyState/EmptyState.test.tsx
index f4a772c0d2..b24dbd812b 100644
--- a/packages/core-components/src/components/EmptyState/EmptyState.test.tsx
+++ b/packages/core-components/src/components/EmptyState/EmptyState.test.tsx
@@ -38,18 +38,16 @@ describe('', () => {
});
it('renders custom image if one is provided', async () => {
- const { getByText, getByRole } = await renderWithEffects(
+ const { getByText } = await renderWithEffects(
wrapInTestApp(
Action}
- customImage={Custom Image
}
+ missing={{ customImage: Custom Image
}}
/>,
),
);
expect(getByText('Some empty state text')).toBeInTheDocument();
expect(getByText('Custom Image')).toBeInTheDocument();
- expect(getByRole('button')).toBeInTheDocument();
});
});
diff --git a/packages/core-components/src/components/EmptyState/EmptyState.tsx b/packages/core-components/src/components/EmptyState/EmptyState.tsx
index 7671dabadb..79f54807ff 100644
--- a/packages/core-components/src/components/EmptyState/EmptyState.tsx
+++ b/packages/core-components/src/components/EmptyState/EmptyState.tsx
@@ -42,14 +42,9 @@ const useStyles = makeStyles(
type Props = {
title: string;
description?: string | JSX.Element;
+ missing: 'field' | 'info' | 'content' | 'data' | { customImage: JSX.Element };
action?: JSX.Element;
-} & (
- | {
- missing: 'field' | 'info' | 'content' | 'data';
- customImage?: never;
- }
- | { missing?: never; customImage: JSX.Element }
-);
+};
/**
* Various placeholder views for empty state pages
@@ -58,7 +53,7 @@ type Props = {
*
*/
export function EmptyState(props: Props) {
- const { title, description, missing, action, customImage } = props;
+ const { title, description, missing, action } = props;
const classes = useStyles();
return (
- {customImage ?? }
+ {typeof missing === 'string' ? : missing.customImage}
);