mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-06 19:37:52 +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
|
@ -50,7 +50,7 @@ export function DocProvider({
|
|||
}: {
|
||||
children: ReactNode;
|
||||
content: PropDocContent;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
const contextValue = useContextValue(content);
|
||||
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ export function DocSidebarItemsExpandedStateProvider({
|
|||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
const [expandedItem, setExpandedItem] = useState<number | null>(null);
|
||||
const contextValue = useMemo(
|
||||
() => ({expandedItem, setExpandedItem}),
|
||||
|
|
|
@ -163,7 +163,7 @@ function DocsPreferredVersionContextProviderUnsafe({
|
|||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
const value = useContextValue();
|
||||
return <Context.Provider value={value}>{children}</Context.Provider>;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ export function DocsPreferredVersionContextProvider({
|
|||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
return (
|
||||
<DocsPreferredVersionContextProviderUnsafe>
|
||||
{children}
|
||||
|
|
|
@ -30,7 +30,7 @@ export function DocsSidebarProvider({
|
|||
children: ReactNode;
|
||||
name: string | undefined;
|
||||
items: PropSidebar | undefined;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
const stableValue: ContextValue | null = useMemo(
|
||||
() => (name && items ? {name, items} : null),
|
||||
[name, items],
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {useMemo} from 'react';
|
||||
import {type ReactNode, useMemo} from 'react';
|
||||
import {matchPath, useLocation} from '@docusaurus/router';
|
||||
import renderRoutes from '@docusaurus/renderRoutes';
|
||||
import {
|
||||
|
@ -363,7 +363,7 @@ Available doc ids are:
|
|||
*/
|
||||
export function useDocRootMetadata({route}: DocRootProps): null | {
|
||||
/** The element that should be rendered at the current location. */
|
||||
docElement: JSX.Element;
|
||||
docElement: ReactNode;
|
||||
/**
|
||||
* The name of the sidebar associated with the current doc. `sidebarName` and
|
||||
* `sidebarItems` correspond to the value of {@link useDocsSidebar}.
|
||||
|
|
|
@ -20,7 +20,7 @@ export function DocsVersionProvider({
|
|||
}: {
|
||||
children: ReactNode;
|
||||
version: PropVersionMetadata | null;
|
||||
}): JSX.Element {
|
||||
}): ReactNode {
|
||||
return <Context.Provider value={version}>{children}</Context.Provider>;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue