DOM typing
/ 1 min read
DOM typings
Check code on playground
we will explore and set type for DOM method; such as document.querySelector()
and document.querySelectorAll()
❌ below is not working
✅ but this works
❌ but this will not work; adding typing ahead to variable
✅ this works ( with as
)
❌ but this will not work ( type )
❌ neither this works (assign)
❎ below syntax are not working
✅ and here is separate type for both DOM method as per my approach
Hope it helps.