Skip to content

Allow writing TypeScript in Script tags with @ts-check #156

@ivanjeremic

Description

@ivanjeremic

Be able to write TypeScript in Script Tags inside .html files. (I'm not asking for compilation support for .html files only allow the usage and check of TS inside .html files Script Tag)

When we do this: we get the error Type annotations can only be used in TypeScript files. when hovering over the Type.

<script>
  let foo: number = 0;
  foo = "hello";
</script>

//@ts-check works and gives me checks and squiggly lines but still gets not rid of the error above.
A Solution would be if this would work.

<script>
 //@ts-check 
  import { mod } from "./this/should/give/autocomplete"
  let foo: number = 0;
  foo = "hello";

  mod();
</script>

The ideal would be if //@ts-check allows the use of TypeScript inside Script Tags.

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