Skip to content

TypeScript syntax highlighting detection incompatible with Astro script processing #7

@HereIsKevin

Description

@HereIsKevin

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions