Look here.
For the first parameter of the addEventListener function, vscode gives me several inbuilt suggestions
How should I make this available in my javascript function?
It could be using Jsdoc or typescript etc.
CodePudding user response:
You can always see what vscode uses for intellisense by hovering on the addEventListener
method or ctrl click
to go to the definition in lib.dom.d.ts
file where all definitions are present.
By doing the above you will see that the vscode uses the keys of a class called WindowEventMap
.
So your function accepting a event listener name could be
function myFunc(event: keyof WindowEventMap): void {
}