Skip to content
Advertisement

Tag: ts-check

Type assert an element in a JS file with @ts-check

I have a JS file with a // @ts-check directive, using JSDoc comments to denote types. The problem is that the elements fail type checks when retrieved from the document. So we have in HTML: When I get this element in JS the type checking throws an error: Property ‘value’ does not exist on type ‘HTMLElement’ If I specify the

Advertisement