fix type errors

This commit is contained in:
sebastien 2024-12-06 18:38:23 +01:00
parent 20fd0afc0e
commit ca7ef20d06
4 changed files with 4 additions and 5 deletions

View file

@ -11,7 +11,7 @@ import {useMutationObserver} from './useMutationObserver';
// Callback fires when the "hidden" attribute of a tabpanel changes // Callback fires when the "hidden" attribute of a tabpanel changes
// See https://github.com/facebook/docusaurus/pull/7485 // See https://github.com/facebook/docusaurus/pull/7485
function useTabBecameVisibleCallback( function useTabBecameVisibleCallback(
codeBlockRef: RefObject<HTMLPreElement>, codeBlockRef: RefObject<HTMLPreElement | null>,
callback: () => void, callback: () => void,
) { ) {
const [hiddenTabElement, setHiddenTabElement] = useState< const [hiddenTabElement, setHiddenTabElement] = useState<
@ -53,7 +53,7 @@ function useTabBecameVisibleCallback(
} }
export function useCodeWordWrap(): { export function useCodeWordWrap(): {
readonly codeBlockRef: RefObject<HTMLPreElement>; readonly codeBlockRef: RefObject<HTMLPreElement | null>;
readonly isEnabled: boolean; readonly isEnabled: boolean;
readonly isCodeScrollable: boolean; readonly isCodeScrollable: boolean;
readonly toggle: () => void; readonly toggle: () => void;

View file

@ -44,7 +44,7 @@ export function useEvent<T extends (...args: never[]) => unknown>(
* Gets `value` from the last render. * Gets `value` from the last render.
*/ */
export function usePrevious<T>(value: T): T | undefined { export function usePrevious<T>(value: T): T | undefined {
const ref = useRef<T>(); const ref = useRef<T>(undefined);
useIsomorphicLayoutEffect(() => { useIsomorphicLayoutEffect(() => {
ref.current = value; ref.current = value;

View file

@ -52,7 +52,7 @@ function useSkipToContent(): {
* so that keyboard navigators can instantly interact with the link and jump * so that keyboard navigators can instantly interact with the link and jump
* to content. * to content.
*/ */
containerRef: React.RefObject<HTMLDivElement>; containerRef: React.RefObject<HTMLDivElement | null>;
/** /**
* Callback fired when the skip to content link has been clicked. * Callback fired when the skip to content link has been clicked.
* It will programmatically focus the main content. * It will programmatically focus the main content.

View file

@ -199,7 +199,6 @@ function DocSearch({
})), })),
).current; ).current;
// @ts-expect-error: TODO fix lib issue after React 19, using JSX.Element
const resultsFooterComponent: DocSearchProps['resultsFooterComponent'] = const resultsFooterComponent: DocSearchProps['resultsFooterComponent'] =
useMemo( useMemo(
() => () =>