Skip to content

Commit d57f5e6

Browse files
committed
Explicitly provide undefined to useRef()
1 parent 46b47cd commit d57f5e6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/react-pdf/src/Document.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ const Document = forwardRef(function Document(
271271

272272
const pages = useRef<HTMLDivElement[]>([]);
273273

274-
const prevFile = useRef<File>();
275-
const prevOptions = useRef<Options>();
274+
const prevFile = useRef<File | undefined>(undefined);
275+
const prevOptions = useRef<Options | undefined>(undefined);
276276

277277
useEffect(() => {
278278
if (file && file !== prevFile.current && isParameterObject(file)) {

packages/react-pdf/src/Page/TextLayer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default function TextLayer() {
4040
const [textContentState, textContentDispatch] = useResolver<TextContent>();
4141
const { value: textContent, error: textContentError } = textContentState;
4242
const layerElement = useRef<HTMLDivElement>(null);
43-
const endElement = useRef<HTMLElement>();
43+
const endElement = useRef<HTMLElement | undefined>(undefined);
4444

4545
warning(
4646
parseInt(

packages/react-pdf/src/shared/hooks/useCachedValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useRef } from 'react';
55
import { isDefined } from '../utils.js';
66

77
export default function useCachedValue<T>(getter: () => T): () => T {
8-
const ref = useRef<T>();
8+
const ref = useRef<T | undefined>(undefined);
99

1010
const currentValue = ref.current;
1111

0 commit comments

Comments
 (0)