New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show exported functions in auto-complete menu #307
Comments
I had a similar issue and found the following workaround, although is too much code for my taste <!-- ClickTracker.svelte -->
<script context='module' lang='ts'>
export type ClickTrackerType = SvelteComponent & { track(): void }
</script>
[...] Then, from <!-- App.svelte -->
<script lang='ts'>
import ClickTracker from "./ClickTracker.svelte";
import type { ClickTrackerType } from "./ClickTracker.svelte";
let componentRef: ClickTrackerType;
</script> On the other hand, inspecting from vscode I found a |
Hm, yeah, that's a good workaround. Though it's definitely more code than is ideal. I also don't like how any changes to the |
@geoffrich of course it's just a workaround until this issue is resolved, supporting typescript means that svelte can correctly generate the typings for my own Svelte component. For me, the ideal syntax would be something like this: let componentRef: ClickTracker and that's it... |
Has this been solved? Trying the ClickTracker example with typescript still gives me the following error:
I'm working recently created from sveltejs/template, with the setupeNode.js script. These are my devDependencies
|
The new VSCode Plugin version was just released, maybe your IDE did not update yet. Newest version is 101.4.0 . |
Excellent!!! |
@opensas @dummdidumm I'm still seeing this issue. Svelte plugin: 104.9.1 Steps to reproduce:
npx degit sveltejs/template svelte-app
cd svelte-app
node ./scripts/setupTypeScript.js
<script>
export function track() {
clicks++;
}
let clicks = 0;
</script>
<p>Clicks: {clicks}</p>
<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>
|
I'm not able to reproduce this, works for me. |
This repository isn't about the jetbrains svelte plugin |
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:
When operating on
componentRef
, I would like to see thetrack
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.The text was updated successfully, but these errors were encountered: