withastro/language-tools

🐛 BUG:Error reported for attribute vscode

ajiho opened this issue · 1 comments

Describe the Bug

image

不能将类型“{ children: any[]; lang: string; myattr: any; }”分配给类型“HtmlHTMLAttributes”。
  类型“HtmlHTMLAttributes”上不存在属性“myattr”。ts(2322)

Why? This syntax can be compiled in Astro, but vscode reports an error, which I think is very unreasonable

Steps to Reproduce

Because the html element doesn't take that attribute normally. The type checking checks for standard attributes.

You can extend the type definition by following the second part of this section: https://docs.astro.build/en/guides/typescript/#built-in-html-attributes