Fix various type errors with strict mode

This commit is contained in:
Ryan Gossiaux
2021-12-15 14:06:33 -08:00
parent 543c1263e3
commit 5b36ce9404
9 changed files with 96 additions and 64 deletions

View File

@@ -8,7 +8,7 @@
<script lang="ts">
import { getContext, onDestroy, setContext } from "svelte";
import { writable, Writable } from "svelte/store";
type OnUpdate = (message: StackMessage, element: HTMLElement | null) => void;
type OnUpdate = (message: StackMessage, element: HTMLElement) => void;
export let onUpdate: OnUpdate | undefined;
export let element: HTMLElement | null;
@@ -31,8 +31,9 @@
_cleanup();
}
if (!element) return null;
$notifyStore(StackMessage.Add, element);
return () => $notifyStore(StackMessage.Remove, element);
let savedElement = element;
$notifyStore(StackMessage.Add, savedElement);
return () => $notifyStore(StackMessage.Remove, savedElement);
})();
onDestroy(() => {