Help with an exported function in a TypeScript/JavaScript project?

I have a little issue with using an exported function.

image




I have no idea why it isn’t working if someone knows :confused:
Thanks, ~Kit

what’s errorcaught variable here?
also curious what project you’re making, privacy pin?~

It’s a string, and yes - I am KitCatLove (Kit) · GitHub and am contributing to GitHub - azomDev/PrivacyPin: Secure self-hosted FOSS location sharing app that prioritizes user privacy and security

1 Like

kinda late but I suspect it’s a syntax issue

try using import { showToast } from "...";

read more here: Understanding JavaScript Exports: Default Export vs. Named Export (dev.to link)

Than’s what I was using before, but when I did that it gave me an error on the import :confused:

@ZincAccount3089

image


But it’s definitely been exported…

Hmm I haven’t worked with svelte so I was looking into the docs a bit to see if I could find something.

And yep sorry, you might have tried this already, or this might be wrong entirely (as idk svelte).

It looks like the +layout files need a render component like: {@render children()} [1]

Another thing i would try is assigning default parameters [2], as your first error indicates to a type mismatch for 2 variables being passed to the function.

Where ever you are importing the showToast, you (i guess) need to use the component: <showToast title=“Bugged” message=“find the bug spray”>

[1] Routing • Docs • Svelte
[2] Props / Default values • Svelte Tutorial

I hope you find whatever is wrong, good luck!

1 Like

Thank you all for the help!
Azom helped me find a fix, what is needed to be used is Svelte store.

Why this wouldn’t work is that I am importing it using a TypeScript file, so it doesn’t have HTML elements.