Closed
Description
Describe the problem
In svelte 4 when typing the bind:this
we used this:
<script lang="ts">
import Component from "./Component.svelte";
let comp: Component | undefined = undefined;
onMount(()=>{
comp.sayHi();
})
</script>
<Component bind:this={comp} />
After running the migration script nothing changes whilst it should be:
<script lang="ts">
import Component from "./Component.svelte";
import {onMount} from "svelte";
let comp: ReturnType<typeof Component> = undefined;
onMount(()=>{
comp.sayHi();
})
</script>
<Component bind:this={comp} />
Describe the proposed solution
Use ReturnType<typeof X>
or use the utility type in #13441 which makes bind:this
type forward-compatibale - easier to change internally without requiring change on the comsumer code.
here is the REPL
Importance
would make my life easier