Closed tofsjonas closed 2 years ago
Yes, the second parameter is kind of a hack to force svelte to update the resolved link when the location changes. You can try casting the second argument to never
to make ts happy. Otherwise this will work, but is slightly more complex:
let resolvedLink;
$: {
if ($location) {
resolvedLink = resolve(path);
}
}
The if condition is always truthy, but again forces svelte to re run the resolve function when the location changes.
That works, thanks! 😊
If I do this, like in the example here: useResolve
I get this error in VSCode:
(Also,
path
is empty, so it doesn't work unless I hardcode it, which makes the logic pointless 😢)