-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.feature requestNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When binding to a component instance, I would like to have any exported functions available for auto-completion.
Describe the solution you'd like
Given the following components:
<!-- App.svelte -->
<script>
import ClickTracker from "./ClickTracker.svelte";
let componentRef;
</script>
<main>
<ClickTracker bind:this={componentRef} />
<button on:click={componentRef.track}>Click me</button>
</main>
<!-- ClickTracker.svelte -->
<script>
export function track() {
clicks++;
}
let clicks = 0;
</script>
<p>Clicks: {clicks}</p>When operating on componentRef, I would like to see the track function show in the auto-complete menu.

Additional context
When using TypeScript with svelte-preprocess, referencing the track function shows the warning "Property 'track' does not exist on type 'ClickTracker__SvelteComponent_'.ts(2339)" under the componentRef.track reference. I think this could be related.
<!-- App.svelte -->
<script lang="ts">
import ClickTracker from "./ClickTracker.svelte";
let componentRef: ClickTracker;
</script>
<main>
<ClickTracker bind:this={componentRef} />
<button on:click={componentRef.track}>Click me</button>
</main>Metadata
Metadata
Assignees
Labels
FixedFixed in master branch. Pending production release.Fixed in master branch. Pending production release.feature requestNew feature or requestNew feature or request