Skip to content
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

Expected ";" but found "const" - typescript transformer #3716

Closed
bartlomiejzuber opened this issue Apr 3, 2024 · 2 comments
Closed

Expected ";" but found "const" - typescript transformer #3716

bartlomiejzuber opened this issue Apr 3, 2024 · 2 comments

Comments

@bartlomiejzuber
Copy link

Casting to 'const' should work as const assertions in TypeScript typically works. I.e. that code shouldn't fail.

Playground URL: https://esbuild.github.io/try/#dAAwLjIwLjIAAGV4cG9ydCBjb25zdCBwcmV2aWV3Q2FyZHMgPSBbCiAgewogICAgdGl0bGU6ICJBYm91dCB1cyIsCiAgICB0ZXh0OiAibG9yZW0gaXBzdW0iLAogICAgY3RhOiAic3VibWl0IiwKICAgIGFsdDogIlBlcnNvbiBzbWlsaW5nIGF3YXkgZnJvbSB0aGVpciBwaG9uZSIsCiAgfSwKICB7CiAgICB0aXRsZTogIkZvciBvdXIgY3VzdG9tZXJzIiwKICAgIHRleHQ6ICJsb3JlbSBpcHN1bSIsCiAgICBjdGE6ICJzdWJtaXQiLAogICAgYWx0OiAiUGVyc29uIHNtaWxpbmcgdGhyb3VnaCB3aW5kb3ciLAogIH1dIGFzIGNvbnN0Ow

Linked issue: withastro/compiler#997

@hyrious
Copy link

hyrious commented Apr 3, 2024

You should enable --loader=ts to tell esbuild the input is in TypeScript (default is JavaScript).

@evanw
Copy link
Owner

evanw commented Apr 3, 2024

Yes, compiling TypeScript as JavaScript is expected to not work on TypeScript-only syntax. Compiling TypeScript as TypeScript works as expected.

I'm closing this issue as this is not a bug with esbuild.

@evanw evanw closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 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

3 participants