Open benmccann opened 1 month ago
<script lang="ts">
const foo = <bar>{ [baz]: qux };
</script>
This is presumably an acorn-typescript bug.
Yeah probably - I think Acorn-Typescript doesn't parse type casts using <..>
properly
Yeah probably - I think Acorn-Typescript doesn't parse type casts using
<..>
properly
Prior to Svelte 5 this worked...
function displayClass(classId: number): void {
displayedClass = <ClassRecord>findParentRecord($classes, classId)
}
Now it has to be...
function displayClass(classId: number): void {
displayedClass = findParentRecord($classes, classId) as ClassRecord
}
TSX does not permit the first type of casting (but I'm using regular TypeScript). Is it possible Acorn-TypeScript is treating TypeScript as TSX?
Yes, that is what is described in the linked issue above: https://github.com/TyrealHu/acorn-typescript/issues/58
Describe the bug
Svelte 5 fails to parse code that Svelte 4 handled:
Reproduction
https://github.com/immich-app/immich/blob/8cf33690b8ddd8e36bdf5d968c3d5700bfcc2949/web/src/lib/components/admin-page/jobs/jobs-panel.svelte#L60
Logs
No response
System Info
Severity
annoyance