svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Svelte 5 TS: `class` property in template literal causes Unterminated template / Unexpected token!

Open cshaa opened this issue 1 year ago • 3 comments
trafficstars

Describe the bug

Optional chaining to a property named class inside a template literal in a TypeScript script breaks the Svelte 5 parser.

Reproduction

<script lang="ts">
  const str = `${obj?.class}`;
</script>

Throws Unterminated template.

<script lang="ts">
  const str = `${obj?.class} ${42}`;
</script>

Throws Unexpected token.

Severity

blocking an upgrade

cshaa avatar Sep 10 '24 17:09 cshaa