Closed dadiborn closed 1 year ago
Hello, which IDE version are you using? To be honest, I don't fully grasp your example. Could you format it differently?
IDEA 2021.2.3 here is quick example: https://github.com/dadiborn/svelte-ts-import-issues both .svelte files has issues on 0.21.0 and 0.21.1 but 0.20.0 works perfectly
UPDATE: I found that this is naming conflicts. Even "Data.svelte" is starts with capital and in same directory "data.ts" is lowercase, it makes conflict and doesn't work properly. To solve this issue we need to move .ts to sub directory if we want to keep name or just rename it so component and ts files doesn't match.
WebStorm Version: 2021.3 Plugin Version: 0.21.1
/////////////////////////////////////////////////////////////////////// I am also experiencing this
// This will rename the database from "localforage"
$: count = 0
$: error = ''
$: email = 'de@gmail.com'
$: password = 'password1234567890'
$: disabled = email.trim() === '' || password.trim() === ''
All variables are highlighted in red and WebStorm says "Unresolved variable or type
Was working earlier, but WebStorm was in constant analysing mode, so I restarted it. Then all my code went red with errors in .svelte files
Project still runs and no errors in console nor in browser.
Edit:
I solved this by putting splitting the variable declaration from the initializes. So above the first $: I put
let count, error, email, password, disabled
Once done that the IDE is happy.
WebStorm Version: 2021.3 Plugin Version: 0.21.1
/////////////////////////////////////////////////////////////////////// I am also experiencing this
// This will rename the database from "localforage" $: count = 0 $: error = '' $: email = 'anthoni.me@gmail.com' $: password = 'password1234567890' $: disabled = email.trim() === '' || password.trim() === ''
All variables are highlighted in red and WebStorm says "Unresolved variable or type "
Was working earlier, but WebStorm was in constant analysing mode, so I restarted it. Then all my code went red with errors in .svelte files
Project still runs and no errors in console nor in browser.
I have the same problem, also version 0.21.1. All of reactive variables behaves like that:
@Takitaf @AnthoniG I haven't seen this reactive variable issues since 0.21.2 On my current setup with all latest updates (for IDE and Plugins) everything works perfectly, so try to update and run File/Invalidate Caches...
This issue was solved some time ago, apologies for not closing it here.
src/App.svelte :: import {myStore} from './folder/component.store'; << OK src/folder/Component.svelte :: import {myStore} from './component.store'; << broken on 0.21.0 | OK on 0.20.0 src/folder/component.store.ts
Version 0.20.0 was the last version where component.store.ts can be imported to Component.svelte this way: import {myStore} from './component.store';
All version above says "Cannot resolve symbol". On broken versions this can be fixed by adding .ts extension at the end on import like so: import {myStore} from './component.store.ts'; This solution with adding extension is incorrect. The problem appears only on sub folders, import on root level works fine.