refactor: prepare types for React 19 (#10746)

This commit is contained in:
Sébastien Lorber 2024-12-06 18:03:04 +01:00 committed by GitHub
parent e9f0641620
commit f9825af43e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
296 changed files with 1105 additions and 915 deletions

View file

@ -17,6 +17,7 @@ declare module '@docusaurus/theme-live-codeblock' {
}
declare module '@theme/Playground' {
import type {ReactNode} from 'react';
import type {Props as BaseProps} from '@theme/CodeBlock';
import type {LiveProvider} from 'react-live';
@ -27,7 +28,7 @@ declare module '@theme/Playground' {
// Allow empty live playgrounds
children?: string;
}
export default function Playground(props: LiveProviderProps): JSX.Element;
export default function Playground(props: LiveProviderProps): ReactNode;
}
declare module '@theme/ReactLiveScope' {

View file

@ -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 clsx from 'clsx';
import useIsBrowser from '@docusaurus/useIsBrowser';
import {LiveProvider, LiveEditor, LiveError, LivePreview} from 'react-live';
@ -23,7 +23,7 @@ import type {ThemeConfig} from '@docusaurus/theme-live-codeblock';
import styles from './styles.module.css';
function Header({children}: {children: React.ReactNode}) {
function Header({children}: {children: ReactNode}) {
return <div className={clsx(styles.playgroundHeader)}>{children}</div>;
}
@ -106,7 +106,7 @@ export default function Playground({
children,
transformCode,
...props
}: Props): JSX.Element {
}: Props): ReactNode {
const {
siteConfig: {themeConfig},
} = useDocusaurusContext();