Argument type Element is not assignable to parameter type HTMLxxxElement

Firstly, this is very similar to the following:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206364059-Argument-type-is-not-assignable-to-parameter-type-when-passing-child

 

Basically, I'm assigning a variable as follows:

var basis_control = document.getElementById('flex-basis-field');

and then passing basis_control to another function whose parameter in JSdoc is declared as {HTMLSelectElement}.

I could go on ignoring statements, but perhaps I'm commenting wrong.

How do I tell the system that document.getElementById is in fact returning a HTMLSelectElement?

Thanks,

Gary

0
2 comments

this is a problem with predefined HTML library - HTMLElement subinterfaces (HTMLSelectElement, HTMLButtonElement, HTMLDivElement, etc.) are not correctly defined in plugins\JavaScriptLanguage\lib\JavaScriptLanguage.jar!\com\intellij\lang\javascript\index\predefined\DHTML.js and thus aren't recognized as Element successors

Please follow https://youtrack.jetbrains.com/issue/WEB-12087 and https://youtrack.jetbrains.com/issue/WEB-12094 for updates

0

Thanks very much, I missed those in my searching.

0

Please sign in to leave a comment.