runem / lit-analyzer

Monorepository for tools that analyze lit-html templates
MIT License
319 stars 38 forks source link

Relax type checking when not using TypeScript? #160

Open pmcelhaney opened 3 years ago

pmcelhaney commented 3 years ago
const th = `<th aria-sort="${sortDirection}">header</th>`

The above code produces the following error

Type 'string' is not assignable to '"ascending" | "descending" | "none" | "other"'

Without using TypeScript, I don't know how I could make the type any more specific than 'string'.

According to the docs:

Assignments in your HTML are typed checked just like it would be in Typescript.

So the answer is clearly not "just use TypeScript". Can the rule be relaxed when the parser is not TypeScript?

pmcelhaney commented 3 years ago

As a work-around, I was able to suppress this warning by adding <!-- @ts-ignore--> to the HTML, per #1.