fix(frontend): migrate type changes

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-10-20 08:49:46 +02:00 committed by renovate[bot]
parent 2f5dadb981
commit 61362f9175
37 changed files with 80 additions and 79 deletions

View file

@ -26,10 +26,10 @@ export const useDocumentSyncScrolling = (
outerContainerRef: React.RefObject<HTMLElement>,
rendererRef: React.RefObject<HTMLElement>,
numberOfLines: number,
scrollState?: ScrollState,
onScroll?: (scrollState: ScrollState) => void
scrollState: ScrollState | null,
onScroll: null | ((scrollState: ScrollState) => void)
): [(lineMarkers: LineMarkerPosition[]) => void, React.UIEventHandler<HTMLElement>] => {
const [lineMarks, setLineMarks] = useState<LineMarkerPosition[]>()
const [lineMarks, setLineMarks] = useState<LineMarkerPosition[]>([])
const recalculateLineMarkerPositions = useCallback(
(linkMarkerPositions: LineMarkerPosition[]) => {

View file

@ -19,7 +19,7 @@ import { useCallback } from 'react'
export const useOnUserScroll = (
lineMarks: LineMarkerPosition[] | undefined,
scrollContainer: React.RefObject<HTMLElement>,
onScroll: ((newScrollState: ScrollState) => void) | undefined
onScroll: ((newScrollState: ScrollState) => void) | null
): React.UIEventHandler<HTMLElement> => {
return useCallback(() => {
if (!scrollContainer.current || !lineMarks || lineMarks.length === 0 || !onScroll) {

View file

@ -18,8 +18,8 @@ import { useCallback, useEffect, useRef } from 'react'
* @param scrollContainer The container to scroll in
*/
export const useScrollToLineMark = (
scrollState: ScrollState | undefined,
lineMarks: LineMarkerPosition[] | undefined,
scrollState: ScrollState | null,
lineMarks: LineMarkerPosition[],
contentLineCount: number,
scrollContainer: RefObject<HTMLElement>
): void => {