lit-analyzer icon indicating copy to clipboard operation
lit-analyzer copied to clipboard

Relax type checking when not using TypeScript?

Open pmcelhaney opened this issue 4 years ago • 1 comments

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 avatar Feb 19 '21 14:02 pmcelhaney

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

pmcelhaney avatar Feb 19 '21 16:02 pmcelhaney