diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index 2dca43bbe17b..bcbdb8042d49 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -27,7 +27,7 @@ export interface DocusaurusConfig { baseUrl: string; baseUrlIssueBanner: boolean; favicon?: string; - tagline?: string; + tagline: string; title: string; url: string; // trailingSlash undefined = legacy retrocompatible behavior => /file => /file/index.html diff --git a/packages/docusaurus/src/client/theme-fallback/Error/index.js b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx similarity index 88% rename from packages/docusaurus/src/client/theme-fallback/Error/index.js rename to packages/docusaurus/src/client/theme-fallback/Error/index.tsx index 1c6dd9a7448e..4d6f35a6bc37 100644 --- a/packages/docusaurus/src/client/theme-fallback/Error/index.js +++ b/packages/docusaurus/src/client/theme-fallback/Error/index.tsx @@ -8,8 +8,9 @@ import React from 'react'; import Layout from '@theme/Layout'; import ErrorBoundary from '@docusaurus/ErrorBoundary'; +import type {Props} from '@theme/Error'; -function ErrorDisplay({error, tryAgain}) { +function ErrorDisplay({error, tryAgain}: Props): JSX.Element { return (
diff --git a/packages/docusaurus/src/client/theme-fallback/Loading/index.js b/packages/docusaurus/src/client/theme-fallback/Loading/index.tsx similarity index 94% rename from packages/docusaurus/src/client/theme-fallback/Loading/index.js rename to packages/docusaurus/src/client/theme-fallback/Loading/index.tsx index 2d088a26a8cf..761c9c3a77b5 100644 --- a/packages/docusaurus/src/client/theme-fallback/Loading/index.js +++ b/packages/docusaurus/src/client/theme-fallback/Loading/index.tsx @@ -6,13 +6,18 @@ */ import React from 'react'; +import type {LoadingComponentProps} from 'react-loadable'; -export default function Loading({error, retry, pastDelay}) { +export default function Loading({ + error, + retry, + pastDelay, +}: LoadingComponentProps): JSX.Element | null { if (error) { return (
= { @@ -51,6 +52,7 @@ export const DEFAULT_CONFIG: Pick< themeConfig: {}, titleDelimiter: '|', noIndex: false, + tagline: '', baseUrlIssueBanner: true, staticDirectories: [STATIC_DIR_NAME], }; @@ -192,7 +194,7 @@ export const ConfigSchema = Joi.object({ }).unknown(), ), clientModules: Joi.array().items(Joi.string()), - tagline: Joi.string().allow(''), + tagline: Joi.string().allow('').default(DEFAULT_CONFIG.tagline), titleDelimiter: Joi.string().default('|'), noIndex: Joi.bool().default(false), webpack: Joi.object({ diff --git a/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap b/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap index 623fa86a83c6..303c36891dc3 100644 --- a/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap +++ b/packages/docusaurus/src/webpack/__tests__/__snapshots__/base.test.ts.snap @@ -24,23 +24,23 @@ Object { "@generated": "../../../../../../..", "@site": "", "@theme-init/PluginThemeComponentEnhanced": "pluginThemeFolder/PluginThemeComponentEnhanced.js", - "@theme-original/Error": "../../../../client/theme-fallback/Error/index.js", - "@theme-original/Layout": "../../../../client/theme-fallback/Layout/index.js", - "@theme-original/Loading": "../../../../client/theme-fallback/Loading/index.js", - "@theme-original/NotFound": "../../../../client/theme-fallback/NotFound/index.js", + "@theme-original/Error": "../../../../client/theme-fallback/Error/index.tsx", + "@theme-original/Layout": "../../../../client/theme-fallback/Layout/index.tsx", + "@theme-original/Loading": "../../../../client/theme-fallback/Loading/index.tsx", + "@theme-original/NotFound": "../../../../client/theme-fallback/NotFound/index.tsx", "@theme-original/PluginThemeComponent1": "pluginThemeFolder/PluginThemeComponent1.js", "@theme-original/PluginThemeComponentEnhanced": "secondPluginThemeFolder/PluginThemeComponentEnhanced.js", "@theme-original/PluginThemeComponentOverriddenByUser": "pluginThemeFolder/PluginThemeComponentOverriddenByUser.js", - "@theme-original/Root": "../../../../client/theme-fallback/Root/index.js", + "@theme-original/Root": "../../../../client/theme-fallback/Root/index.tsx", "@theme-original/subfolder/PluginThemeComponent2": "pluginThemeFolder/subfolder/PluginThemeComponent2.js", - "@theme/Error": "../../../../client/theme-fallback/Error/index.js", - "@theme/Layout": "../../../../client/theme-fallback/Layout/index.js", - "@theme/Loading": "../../../../client/theme-fallback/Loading/index.js", - "@theme/NotFound": "../../../../client/theme-fallback/NotFound/index.js", + "@theme/Error": "../../../../client/theme-fallback/Error/index.tsx", + "@theme/Layout": "../../../../client/theme-fallback/Layout/index.tsx", + "@theme/Loading": "../../../../client/theme-fallback/Loading/index.tsx", + "@theme/NotFound": "../../../../client/theme-fallback/NotFound/index.tsx", "@theme/PluginThemeComponent1": "pluginThemeFolder/PluginThemeComponent1.js", "@theme/PluginThemeComponentEnhanced": "src/theme/PluginThemeComponentEnhanced.js", "@theme/PluginThemeComponentOverriddenByUser": "src/theme/PluginThemeComponentOverriddenByUser.js", - "@theme/Root": "../../../../client/theme-fallback/Root/index.js", + "@theme/Root": "../../../../client/theme-fallback/Root/index.tsx", "@theme/UserThemeComponent1": "src/theme/UserThemeComponent1.js", "@theme/subfolder/PluginThemeComponent2": "pluginThemeFolder/subfolder/PluginThemeComponent2.js", "@theme/subfolder/UserThemeComponent2": "src/theme/subfolder/UserThemeComponent2.js", diff --git a/packages/docusaurus/tsconfig.client.json b/packages/docusaurus/tsconfig.client.json index 5a33d4b528f6..66613cf7c22d 100644 --- a/packages/docusaurus/tsconfig.client.json +++ b/packages/docusaurus/tsconfig.client.json @@ -7,7 +7,7 @@ "tsBuildInfoFile": "./lib/client/.tsbuildinfo", "rootDir": "src/client", "outDir": "lib/client", - "jsx": "react" + "jsx": "react-native" }, "include": ["src/client", "src/deps.d.ts"] }