Skip to content

Commit

Permalink
chore(@lexical/playground): Remove unnecessary type assertions from u…
Browse files Browse the repository at this point in the history
…seReport.ts (#5884)
  • Loading branch information
2wheeh authored Apr 16, 2024
1 parent 650d93c commit aba3160
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/lexical-playground/src/hooks/useReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export default function useReport(): (
) => ReturnType<typeof setTimeout> {
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
const cleanup = useCallback(() => {
if (timer !== null) {
clearTimeout(timer.current as ReturnType<typeof setTimeout>);
if (timer.current !== null) {
clearTimeout(timer.current);
timer.current = null;
}

if (document.body) {
Expand All @@ -54,7 +55,9 @@ export default function useReport(): (
// eslint-disable-next-line no-console
console.log(content);
const element = getElement();
clearTimeout(timer.current as ReturnType<typeof setTimeout>);
if (timer.current !== null) {
clearTimeout(timer.current);
}
element.innerHTML = content;
timer.current = setTimeout(cleanup, 1000);
return timer.current;
Expand Down

0 comments on commit aba3160

Please sign in to comment.