Skip to content

const type paremeter svelte(js_parse_error) #14864

Closed
@max-kamps

Description

@max-kamps

Describe the bug

const type parameters are a feature added in Typescript 5.0.
However, trying to use them in a .svelte or .svelte.ts file results in Unexpected keyword 'const' https://svelte.dev/e/js_parse_error

This is presumably a missing feature in acorn-typescript, and as such blocked by #13439

Reproduction

<script lang=ts>
  function test<const T>(value: T) {
    return value;
  }
</script>

<h1>Hello {test("World")}!</h1>

Logs

No response

System Info

System:
    OS: Linux 6.12 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 7840U w/ Radeon  780M Graphics
    Memory: 17.86 GB / 30.66 GB
    Container: Yes
    Shell: 5.2.37 - /bin/bash
  Binaries:
    Node: 23.4.0 - ~/.nvm/versions/node/v23.4.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v23.4.0/bin/npm
  npmPackages:
    rollup: ^4.29.1 => 4.29.1

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions