Skip to content
New issue

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

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

Already on GitHub? # to your account

TypeScript syntax highlighting detection incompatible with Astro script processing #7

Closed
HereIsKevin opened this issue Jun 26, 2023 · 1 comment

Comments

@HereIsKevin
Copy link

Hi,

While using Sublime Text 4143 on macOS Ventura 13.4, TypeScript syntax highlighting seems to be broken.
Screenshot 2023-06-25 at 6 04 03 PM

After adding lang="ts", highlighting seems to work.
Screenshot 2023-06-25 at 6 04 39 PM

However, using attributes to detect TypeScript seems to break Astro's script bundling, as mentioned here

NOTE
Astro’s default bundling behavior will be disabled in some situations. In particular, adding type="module" or any attribute other than src to a <script> tag will cause Astro to treat the tag as if it had an is:inline directive. The same will be true when the script is written in a JSX expression.

This causes the script to be bundled as JavaScript, not as TypeScript, so it is never bundled.

I'm not sure how this could be fixed, but assuming that all scripts are TypeScript may be a potential solution, as TypeScript is a JavaScript superset, so could you look into that?

Thanks in advance!

@deathaxe
Copy link
Member

Thank's for reporting. The next release declares TypeScript as default syntax in script tags.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants