You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a problem with syntax highlighting, auto-import, svelte-check and Quick Fix options for importing Typescript types.
E.g. for this code
<script lang="ts">
import { Link } from 'svelte-navigator'
export let navigate: NavigateFn
</script>
auto-import
During typing the word "NavigateFn" intellisense displays a tooltip to auto-import this type from svelte-navigator. The auto-import adds the type to existing import, resulting in: import { Link, NavigateFn } from 'svelte-navigator'
Quick Fix
The same happens when choosing a Quick Fix option to add NavigateFn to existing import (this is the only option to choose).
syntax highlighting
All is looking ok inside VSCode, despite adding a compiler option in tsconfig.json: "importsNotUsedAsValues": "error"
Setting this option to "remove" or "preserve" seems to have no impact on VSCode behavior, either.
The problem is within svelte-preprocess. Since svelte-preprocess only knows the content of the script, it does not know whether something is a type or a value import, so you need to strictly separate them. TypeScript can't help here because it's okay with import as long as there's at least one value import.
See sveltejs/svelte-preprocess#318 for more info and a possible way to fix this.
Keeping this open for visibility
I noticed a problem with syntax highlighting, auto-import, svelte-check and Quick Fix options for importing Typescript types.
E.g. for this code
auto-import
During typing the word "NavigateFn" intellisense displays a tooltip to auto-import this type from svelte-navigator. The auto-import adds the type to existing import, resulting in:
import { Link, NavigateFn } from 'svelte-navigator'
Quick Fix
The same happens when choosing a Quick Fix option to add NavigateFn to existing import (this is the only option to choose).
syntax highlighting
All is looking ok inside VSCode, despite adding a compiler option in tsconfig.json:
"importsNotUsedAsValues": "error"
Setting this option to "remove" or "preserve" seems to have no impact on VSCode behavior, either.
svelte-check
No error
During runtime there is an error:
The expected behavior is to:
either display an error inside VSCode and in svelte-check, according to the
"importsNotUsedAsValues": "error"
typescript settingor make auto-import and Quick Fix use type-only import for types, resulting in code:
The text was updated successfully, but these errors were encountered: