From 2d1ccf16cbef17a12febff3580cc1a18d8746ef9 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Sun, 26 Mar 2023 03:26:42 +0800 Subject: [PATCH] Pesky `jsdoc` type coercions are pesky --- src/lib/SvelteToast.svelte | 6 ++++-- src/lib/ToastItem.svelte | 6 +++++- src/lib/stores.js | 19 ++++++++++--------- src/routes/+page.svelte | 16 ++++++++++------ src/routes/Dummy.svelte | 6 +++--- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/src/lib/SvelteToast.svelte b/src/lib/SvelteToast.svelte index ef4775c..66eafd8 100644 --- a/src/lib/SvelteToast.svelte +++ b/src/lib/SvelteToast.svelte @@ -9,10 +9,12 @@ export let options = {} /** @type {(string|'default')} */ export let target = 'default' +/** @type {import('./stores').SvelteToastOptions[]} */ let items = [] +/** @param {Object} [theme] */ function getCss(theme) { - return Object.keys(theme).reduce((a, c) => `${a}${c}:${theme[c]};`, '') + return theme ? Object.keys(theme).reduce((a, c) => `${a}${c}:${theme[c]};`, '') : undefined } $: toast._init(target, options) @@ -23,7 +25,7 @@ $: items = $toast.filter((i) => i.target === target)