Skip to content

svelte cli: error when converting typescript with angle-brackets casting #14571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
werner-drklein opened this issue Dec 5, 2024 · 1 comment

Comments

@werner-drklein
Copy link

Describe the bug

sv migrate svelte-5

fails with an error like

Error while migrating Svelte code [InternalCompileError: Unexpected token `}`. Did you mean `}` or `{"}"}`?] {

when typescript code contains casting using angle-brackets. (<>)

Reproduction

in typescript code use angle-brackets casting:

const variable = <string>somevar;

If you instead cast using the as keyword, it works as expected:

const variable = somevar as string;

Logs

No response

System Info

sv 0.6.6


  System:
    OS: macOS 14.7.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 104.59 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 9.12.2 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 131.0.6778.108
    Edge: 131.0.2903.70
    Safari: 18.1.1

Severity

annoyance

@paoloricciuti
Copy link
Member

This is a known issue with acorn typescript...thanks for reporting tho!

closing as duplicate of #13179

@paoloricciuti paoloricciuti closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants