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
Node: 20.11.1
svelte: 5.0.0-next.132
ts: 5.4.5
tsconfig: auto, included in create@svelte without custom editions
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
Calling the Error for use with and without this preprocessor
Severity
annoyance
The text was updated successfully, but these errors were encountered:
I created a repository and found what is the trigger of my problem.
For WebStorm, I changed the target in the compilerOptions (tsconfig). The ES2020 target is incompatible and throws an error in this case.
This is a documentation issue for TS usage.
I outlined the requirements before over here.
You may have a TS configuration that specifies a target (or uses the default) which causes the class to be compiled down to a function for compatibility with < ES6 or the class field initializers may be turned into constructor assignments.
Hence you have to make sure the target is at least "es6" or "es2015" and if the target is lower than "es2022" then useDefineForClassFields has to be set to true (see documentation and notes on default value).
If constructor assignments are allowed (#11455), just the transpilation of classes would need to be prevented.
Describe the bug
This code throw Error when file named with .ts extention:
CompileError:
$state(...)
can only be used as a variable declaration initializer or a class fieldIf the file is named .js, everything is working correctly.
Reproduction
I've been researching the internal files and this is what I found:
svelte\src\compiler\phases\2-analyze:
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: