You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm trying to export spring stores but I can't specify their types as Spring<...> for the external binding variables.
Describe the solution you'd like
Can the Spring interface be exported?
<!-- file: welcome.svelte --><!-- some unrelated markup -->
<divclass="circle"style=" --x:{$x}px; --y:{$y}px;"
>r</div>
<!-- some more unrelated markup -->
<style>
.circle{--x:0;--y:0;top:var(--y);left:var(--x);}
</style>
<scriptlang="ts">
//...import { spring } from'svelte/motion';exportlet x =spring(0,{ stiffness: 0.1, damping: 0.25});exportlet y =spring(0,{ stiffness: 0.1, damping: 0.25});//...onMount(()=>{document.addEventListener("mousemove",e=>{//some logicx.set(/*some value*/);y.set(/*some value*/); });})
</script>
Being able to do this and specify types would be useful:
<!-- file: home.svelte -->
<Welcomebind:xbind:y/>
<scriptlang="ts">
importtype { Spring } from'svelte/motion'; // <=== this would be usefulimportWelcomefrom'./welcome.svelte';let x:Spring<number>;let y:Spring<number>;//now I know for sure that x and y are Spring<number>
</script>
Is your feature request related to a problem? Please describe.
I'm trying to export spring stores but I can't specify their types as
Spring<...>
for the external binding variables.Describe the solution you'd like
Can the
Spring
interface be exported?svelte/src/runtime/motion/spring.ts
Lines 61 to 67 in ce3a579
Use case
Being able to do this and specify types would be useful:
Same thing with Tweened:
svelte/src/runtime/motion/tweened.ts
Lines 66 to 70 in ce3a579
The text was updated successfully, but these errors were encountered: