diff --git a/packages/docusaurus-module-type-aliases/src/index.d.ts b/packages/docusaurus-module-type-aliases/src/index.d.ts index 3a900c907d77..c8f2c995f012 100644 --- a/packages/docusaurus-module-type-aliases/src/index.d.ts +++ b/packages/docusaurus-module-type-aliases/src/index.d.ts @@ -77,14 +77,9 @@ declare module '@theme-original/*'; declare module '@theme-init/*'; declare module '@theme/Error' { - import type {ComponentProps} from 'react'; - import type ErrorBoundary from '@docusaurus/ErrorBoundary'; + import type {FallbackParams} from '@docusaurus/ErrorBoundary'; - type ErrorProps = ComponentProps< - NonNullable['fallback']> - >; - - export interface Props extends ErrorProps {} + export interface Props extends FallbackParams {} export default function Error(props: Props): JSX.Element; } @@ -125,13 +120,17 @@ declare module '@docusaurus/constants' { } declare module '@docusaurus/ErrorBoundary' { - import type {ReactNode, ComponentType} from 'react'; + import type {ReactNode} from 'react'; + + export type FallbackParams = { + readonly error: Error; + readonly tryAgain: () => void; + }; + + export type FallbackFunction = (params: FallbackParams) => JSX.Element; export interface Props { - readonly fallback?: ComponentType<{ - readonly error: Error; - readonly tryAgain: () => void; - }>; + readonly fallback?: FallbackFunction; readonly children: ReactNode; } export default function ErrorBoundary(props: Props): JSX.Element; diff --git a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx index c5503edcaaa2..7f58712af95c 100644 --- a/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx +++ b/packages/docusaurus-theme-classic/src/theme/Layout/index.tsx @@ -45,7 +45,9 @@ export default function Layout(props: Props): JSX.Element {
- {children} + }> + {children} +
{!noFooter &&