sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.42k stars 4.11k forks source link

Svelte 5: Identifier <x> has already been declared #11416

Open rChaoz opened 4 months ago

rChaoz commented 4 months ago

Describe the bug

In TypeScript, it is common to have variables and types with the same name. Svelte 5 native TypeScript support prohibits this, breaking existing TypeScript code.

Reproduction

let Something = 5

interface Something {}

REPL

Logs

Error: Identifier 'Something' has already been declared (svelte)

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700KF
    Memory: 13.10 GB / 31.86 GB
  Binaries:
    Node: 20.8.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 4.1.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.2.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0)
    Internet Explorer: 11.0.19041.1566

Severity

annoyance

rChaoz commented 4 months ago

Probably related to #11412

Rich-Harris commented 4 months ago

This is an issue in acorn-typescript: https://github.com/TyrealHu/acorn-typescript/issues/50