tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
485 stars 38 forks source link

Support TypeScript in Svelte markup #207

Closed btakita closed 1 year ago

btakita commented 3 years ago

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.

ynhhoJ commented 2 years ago

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: изображение изображение

KennethHoff commented 2 years ago

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

tomblachut commented 1 year ago

Contained in WEB-58397 use the svelte language server.