mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-23 19:48:54 +02:00
refactor: prepare types for React 19 (#10746)
This commit is contained in:
parent
e9f0641620
commit
f9825af43e
296 changed files with 1105 additions and 915 deletions
|
@ -14,46 +14,57 @@ declare module '@docusaurus/plugin-debug' {
|
|||
}
|
||||
|
||||
declare module '@theme/DebugConfig' {
|
||||
export default function DebugMetadata(): JSX.Element;
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugMetadata(): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugContent' {
|
||||
import type {ReactNode} from 'react';
|
||||
import type {AllContent} from '@docusaurus/types';
|
||||
|
||||
export interface Props {
|
||||
readonly allContent: AllContent;
|
||||
}
|
||||
export default function DebugContent(props: Props): JSX.Element;
|
||||
export default function DebugContent(props: Props): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugGlobalData' {
|
||||
export default function DebugGlobalData(): JSX.Element;
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugGlobalData(): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugJsonView' {
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export interface Props {
|
||||
readonly src: unknown;
|
||||
readonly collapseDepth?: number;
|
||||
}
|
||||
export default function DebugJsonView(props: Props): JSX.Element;
|
||||
export default function DebugJsonView(props: Props): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugLayout' {
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugLayout(props: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element;
|
||||
export default function DebugLayout(props: {children: ReactNode}): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugRegistry' {
|
||||
export default function DebugRegistry(): JSX.Element;
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugRegistry(): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugRoutes' {
|
||||
export default function DebugRoutes(): JSX.Element;
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugRoutes(): ReactNode;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugSiteMetadata' {
|
||||
export default function DebugSiteMetadata(): JSX.Element;
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export default function DebugSiteMetadata(): ReactNode;
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
export default function DebugMetadata(): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<DebugLayout>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
|
@ -52,7 +52,7 @@ function PluginContent({
|
|||
);
|
||||
}
|
||||
|
||||
export default function DebugContent({allContent}: Props): JSX.Element {
|
||||
export default function DebugContent({allContent}: Props): ReactNode {
|
||||
return (
|
||||
<DebugLayout>
|
||||
<h2>Plugin content</h2>
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import useGlobalData from '@docusaurus/useGlobalData';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
export default function DebugMetadata(): ReactNode {
|
||||
const globalData = useGlobalData();
|
||||
return (
|
||||
<DebugLayout>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import {
|
||||
JsonView,
|
||||
defaultStyles,
|
||||
|
@ -32,10 +32,7 @@ const paraisoStyles: JsonViewProps['style'] = {
|
|||
collapsedContent: styles.collapseContentParaiso!,
|
||||
};
|
||||
|
||||
export default function DebugJsonView({
|
||||
src,
|
||||
collapseDepth,
|
||||
}: Props): JSX.Element {
|
||||
export default function DebugJsonView({src, collapseDepth}: Props): ReactNode {
|
||||
return (
|
||||
<JsonView
|
||||
data={src as object}
|
||||
|
|
|
@ -29,7 +29,7 @@ export default function DebugLayout({
|
|||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import registry from '@generated/registry';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugRegistry(): JSX.Element {
|
||||
export default function DebugRegistry(): ReactNode {
|
||||
return (
|
||||
<DebugLayout>
|
||||
<h2>Registry</h2>
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import routes from '@generated/routes';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import DebugJsonView from '@theme/DebugJsonView';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugRoutes(): JSX.Element {
|
||||
export default function DebugRoutes(): ReactNode {
|
||||
return (
|
||||
<DebugLayout>
|
||||
<h2>Routes</h2>
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import DebugLayout from '@theme/DebugLayout';
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function DebugMetadata(): JSX.Element {
|
||||
export default function DebugMetadata(): ReactNode {
|
||||
const {siteMetadata} = useDocusaurusContext();
|
||||
return (
|
||||
<DebugLayout>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue