svelte-intellij
svelte-intellij copied to clipboard
Support TypeScript in Svelte markup
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
.
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:
This issue is the sole reason atm I cannot recommend Svelte to my colleagues :/
Contained in WEB-58397 use the svelte language server.