make Provider required in AppTheme

Signed-off-by: Colton Padden <colton.padden@fastmail.com>
This commit is contained in:
Colton Padden
2021-12-20 13:16:52 -05:00
parent e654134d22
commit cb278fa3ad
4 changed files with 4 additions and 5 deletions
@@ -87,9 +87,6 @@ export function AppThemeProvider({ children }: PropsWithChildren<{}>) {
if (!appTheme) {
throw new Error('App has no themes');
}
if (!appTheme.Provider) {
throw new Error('App has no theme provider');
}
return <appTheme.Provider children={children} />;
}
+1 -1
View File
@@ -164,7 +164,7 @@ export type AppTheme = {
title: string;
variant: 'light' | 'dark';
icon?: React.ReactElement;
Provider?(props: { children: ReactNode }): JSX.Element | null;
Provider(props: { children: ReactNode }): JSX.Element | null;
};
// @public
@@ -44,7 +44,7 @@ export type AppTheme = {
*/
icon?: React.ReactElement;
Provider?(props: { children: ReactNode }): JSX.Element | null;
Provider(props: { children: ReactNode }): JSX.Element | null;
};
/**
@@ -40,11 +40,13 @@ describe('SidebarThemeSwitcher', () => {
id: 'dark',
title: 'Dark Theme',
variant: 'dark',
Provider: jest.fn(),
},
{
id: 'light',
title: 'Light Theme',
variant: 'light',
Provider: jest.fn(),
},
]);
});