svelte-intellij icon indicating copy to clipboard operation
svelte-intellij copied to clipboard

Support TypeScript in Svelte markup

Open btakita opened this issue 3 years ago • 2 comments

If a Component uses Typescript, the types should carry over into the markup.

<script lang=ts>
interface Peach {
  color:'white'|'pink'|'brown'
}
export let peaches = [] as Peach[]
</script>
{#each peaches as peach,idx}
  <div>Peach number {idx} is {peach.color}</div>
{/each}

In the above example, the variable peach should be typed. Javascript inference occurs, which is somewhat useful, but limited in usefulness. For example, the Type Info command resolves to <unknown type> for both peach & idx.

btakita avatar Mar 12 '21 18:03 btakita

I have the same problems usign Webstorm with the latest version of plugin. each doesn't recognize data as Book type.

изображение изображение

In VSCode everything is okay: изображение изображение

ynhhoJ avatar Apr 02 '22 21:04 ynhhoJ

This issue is the sole reason atm I cannot recommend Svelte to my colleagues :/

KennethHoff avatar Apr 10 '22 08:04 KennethHoff

Contained in WEB-58397 use the svelte language server.

tomblachut avatar Aug 01 '23 18:08 tomblachut