From 0acfe665034fdf4578156ebaf4372713cf23bce4 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 14 Aug 2024 08:39:56 +0200 Subject: [PATCH] [docs-infra] Fix some TS issues for X docs (#43285) --- docs/src/modules/components/ApiPage.tsx | 8 ++++---- docs/src/modules/components/AppLayoutDocs.d.ts | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 docs/src/modules/components/AppLayoutDocs.d.ts diff --git a/docs/src/modules/components/ApiPage.tsx b/docs/src/modules/components/ApiPage.tsx index d4922012191136..d3aab5ed9d85ba 100644 --- a/docs/src/modules/components/ApiPage.tsx +++ b/docs/src/modules/components/ApiPage.tsx @@ -94,7 +94,7 @@ interface ApiPageProps { descriptions: { [lang: string]: PropsTranslations & { // Table of Content added by the mapApiPageTranslations function - componentDescriptionToc: TableOfContentsEntry[]; + componentDescriptionToc: TableOfContentsParams[]; }; }; disableAd?: boolean; @@ -180,17 +180,17 @@ export default function ApiPage(props: ApiPageProps) { slotDescriptions, }); - function createTocEntry(sectionName: ApiHeaderKeys) { + function createTocEntry(sectionName: ApiHeaderKeys): TableOfContentsParams { return { text: getTranslatedHeader(t, sectionName), hash: sectionName, children: [ ...(sectionName === 'props' && inheritance ? [{ text: t('api-docs.inheritance'), hash: 'inheritance', children: [] }] - : []), + : ([] as TableOfContentsParams[])), ...(sectionName === 'props' && pageContent.themeDefaultProps ? [{ text: t('api-docs.themeDefaultProps'), hash: 'theme-default-props', children: [] }] - : []), + : ([] as TableOfContentsParams[])), ], }; } diff --git a/docs/src/modules/components/AppLayoutDocs.d.ts b/docs/src/modules/components/AppLayoutDocs.d.ts new file mode 100644 index 00000000000000..6f69c309e6de0d --- /dev/null +++ b/docs/src/modules/components/AppLayoutDocs.d.ts @@ -0,0 +1,18 @@ +export interface AppLayoutDocsProps { + BannerComponent: React.ElementType; + cardOptions: { + description: string; + title: string; + }; + children: React.ReactNode; + description: string; + disableAd: boolean; + disableLayout: boolean; + disableToc: boolean; + hasTabs: boolean; + location: string; + title: string; + toc: any[]; +} + +export default React.ComponentType;