How to Force JavaScript Variables to use Specific DOM APIsby@fhacker
455 reads

How to Force JavaScript Variables to use Specific DOM APIs

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

To take advantage of JavaScript IntelliSense and code completion when using a certain awesome text editor *ehem* VS Code, you need to be able to declare the correct interfaces for variables containing DOM elements. For example, if you want to make a variable use a specific DOM interface like the generic type HTMLElement, just do: Before assigning it to a specific type: "Before you assign it," "before you do it" Then, you get code completion for all the methods and other awesomeness that TypeScript doesn’t.
featured image - How to Force JavaScript Variables to use Specific DOM APIs
AYO HackerNoon profile picture

@fhacker

AYO

Ayo Ayco is a software engineer focused on the Web


Receive Stories from @fhacker

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!