tomblachut / svelte-intellij

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

Type Inference resulting in Store type instead of Store value type #202

Closed btakita closed 3 years ago

btakita commented 3 years ago

If a function returns a store & has an assigned type, the plugin does not seem to infer the store's value type but incorrectly infers the store type instead.

<script lang="ts">
import { writable } from 'svelte/store'
import type { Writable } from 'svelte/store'
const name:Writable<string> = writable('test')
$: cleaned_name = $name.replace(/ +/g, ' ')
</script>

Note that $name is incorrectly inferred as a Writable<string> instead of a string

btakita commented 3 years ago

Adding node_modules to the Idea Libraries fixed the issue.

See https://youtrack.jetbrains.com/issue/WEB-49929