I have the following code :
document.querySelector('.edit').classList.add('hidden');
TypeScript tells me that the object returned by querySelector does not have classList as a method, with the following error :
Error TS2094: The property 'classList' does not exist on value of type 'Element'.
When I looked at what querySelector returns, I found that it returns Element. so I had to cast it to HTMLElement to be able to use classList like so :
(<HTMLElement>document.querySelector('.edit')).classList.add('hidden');
but like you might guess, at some point it starts to be counter productive, so I am asking you : Is there any sane way to get the classList from querySelector? Am I doing something wrong ? My guess is that I need to Overload the definition of querySelector.
Thank you