diff --git a/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts b/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts index 208584861a28..12cf2eff4c8d 100644 --- a/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts +++ b/packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts @@ -11,7 +11,7 @@ import {useMutationObserver} from './useMutationObserver'; // Callback fires when the "hidden" attribute of a tabpanel changes // See https://github.com/facebook/docusaurus/pull/7485 function useTabBecameVisibleCallback( - codeBlockRef: RefObject, + codeBlockRef: RefObject, callback: () => void, ) { const [hiddenTabElement, setHiddenTabElement] = useState< @@ -53,7 +53,7 @@ function useTabBecameVisibleCallback( } export function useCodeWordWrap(): { - readonly codeBlockRef: RefObject; + readonly codeBlockRef: RefObject; readonly isEnabled: boolean; readonly isCodeScrollable: boolean; readonly toggle: () => void; diff --git a/packages/docusaurus-theme-common/src/utils/reactUtils.tsx b/packages/docusaurus-theme-common/src/utils/reactUtils.tsx index e426d3d8526a..764b34ec98f5 100644 --- a/packages/docusaurus-theme-common/src/utils/reactUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/reactUtils.tsx @@ -44,7 +44,7 @@ export function useEvent unknown>( * Gets `value` from the last render. */ export function usePrevious(value: T): T | undefined { - const ref = useRef(undefined); + const ref = useRef(); useIsomorphicLayoutEffect(() => { ref.current = value; diff --git a/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx b/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx index fcc4228a6830..3c5e16fd1cf1 100644 --- a/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx +++ b/packages/docusaurus-theme-common/src/utils/skipToContentUtils.tsx @@ -52,7 +52,7 @@ function useSkipToContent(): { * so that keyboard navigators can instantly interact with the link and jump * to content. */ - containerRef: React.RefObject; + containerRef: React.RefObject; /** * Callback fired when the skip to content link has been clicked. * It will programmatically focus the main content. diff --git a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx index 21da9aeedfd2..d367dada2672 100644 --- a/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx +++ b/packages/docusaurus-theme-search-algolia/src/theme/SearchBar/index.tsx @@ -199,6 +199,7 @@ function DocSearch({ })), ).current; + // @ts-expect-error: TODO fix lib issue after React 19, using JSX.Element const resultsFooterComponent: DocSearchProps['resultsFooterComponent'] = useMemo( () => diff --git a/packages/docusaurus/src/client/exports/Link.tsx b/packages/docusaurus/src/client/exports/Link.tsx index e294ecff7b70..76c9f4f5ea69 100644 --- a/packages/docusaurus/src/client/exports/Link.tsx +++ b/packages/docusaurus/src/client/exports/Link.tsx @@ -100,7 +100,7 @@ function Link( const IOSupported = ExecutionEnvironment.canUseIntersectionObserver; - const ioRef = useRef(undefined); + const ioRef = useRef(); const handleRef = (el: HTMLAnchorElement | null) => { innerRef.current = el;