test: fix some type errors in test files (#7486)

This commit is contained in:
Joshua Chen 2022-05-25 11:46:10 +08:00 committed by GitHub
parent 624735bd92
commit e2e40b8f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 319 additions and 182 deletions

View file

@ -9,7 +9,7 @@ import {updateTranslationFileMessages} from '@docusaurus/utils';
import {getTranslationFiles, translateThemeConfig} from '../translations';
import type {ThemeConfig} from '@docusaurus/theme-common';
const ThemeConfigSample: ThemeConfig = {
const ThemeConfigSample = {
colorMode: {},
announcementBar: {},
prism: {},
@ -47,7 +47,7 @@ const ThemeConfigSample: ThemeConfig = {
},
],
},
};
} as unknown as ThemeConfig;
const ThemeConfigSampleSimpleFooter: ThemeConfig = {
...ThemeConfigSample,

View file

@ -674,7 +674,7 @@ describe('themeConfig', () => {
});
it('max config', () => {
const colorMode = {
const colorMode: ThemeConfig['colorMode'] = {
defaultMode: 'dark',
disableSwitch: false,
respectPrefersColorScheme: true,

View file

@ -1032,10 +1032,10 @@ declare module '@theme/Tabs' {
readonly lazy?: boolean;
readonly block?: boolean;
readonly children: readonly ReactElement<TabItemProps>[];
readonly defaultValue?: string | null;
readonly defaultValue?: string | number | null;
readonly values?: readonly {
value: string;
label?: string;
value: string | number;
label?: string | number;
attributes?: {[key: string]: unknown};
}[];
readonly groupId?: string;

View file

@ -115,7 +115,7 @@ function TabsComponent(props: Props): JSX.Element {
setSelectedValue(newTabValue);
if (groupId != null) {
setTabGroupChoices(groupId, newTabValue);
setTabGroupChoices(groupId, String(newTabValue));
}
}
};