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
In the provided code example, let isProgrammingCategory; works, but as soon as you add a type to it like let isProgrammingCategory: boolean; the compile error occurs like attached below in the stacktrace.
When you remove <Image /> and the svelte-image import from the file, everything works again as expected also with type annotations.
Unfortunately, I couldn't provide an example since Svelte REPL doesn't work with typescript yet.
Encountered while running sapper dev.
Expected behavior
Able to add typescript annotations to any .svelte file
Stacktraces
Stacktrace
CompileError [ParseError]: Unexpected token
at error$1 (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:15595:20)
at Parser$1.error (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:15671:10)
at Parser$1.acorn_error (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:15665:15)
at Object.read_script [as read] (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:7377:17)
at tag (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:14737:34)
at new Parser$1 (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:15630:22)
at Object.parse$3 [as parse] (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:15761:21)
at replaceImages (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte-image/src/main.js:483:18)
at markup (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte-image/src/main.js:531:19)
at preprocess (/home/markus/Applications/Webdevelopment/mhatvan.github.io/node_modules/svelte/compiler.js:26987:34) {
code: 'parse-error',
start: { line: 25, column: 27, character: 584 },
end: { line: 25, column: 27, character: 584 },
pos: 584,
filename: undefined,
frame: '23: \n' +
'24: // adding types throws compiler error for some reason\n' +
'25: let isProgrammingCategory: boolean;\n' +
' ^\n' +
'26: let goals = [];\n' +
'27: '
} Error parsing component content
Information about your Svelte project:
Your browser and the version: Brave v1.12.114
Your operating system: Ubuntu Linux 20.04
Svelte version: v3.24.1
Whether your project uses Webpack or Rollup: Rollup
Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?
Moderate, having to stay off typescript annotations for that complete file.
The text was updated successfully, but these errors were encountered:
This sounds like #4141 - svelte-image needs to get to get a compilable version of the whole component but, since it's a template preprocessor, it runs before the script preprocessor that handles the TypeScript.
Describe the bug
Code example throwing error
In the provided code example,
let isProgrammingCategory;
works, but as soon as you add a type to it likelet isProgrammingCategory: boolean;
the compile error occurs like attached below in the stacktrace.When you remove
<Image />
and thesvelte-image
import from the file, everything works again as expected also with type annotations.Unfortunately, I couldn't provide an example since Svelte REPL doesn't work with typescript yet.
Encountered while running
sapper dev
.Expected behavior
Able to add typescript annotations to any
.svelte
fileStacktraces
Stacktrace
Information about your Svelte project:
Your browser and the version: Brave v1.12.114
Your operating system: Ubuntu Linux 20.04
Svelte version: v3.24.1
Whether your project uses Webpack or Rollup: Rollup
Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?
Moderate, having to stay off typescript annotations for that complete file.
The text was updated successfully, but these errors were encountered: