Skip to content
Advertisement

Tag: jsdoc

Vscode available properties intellisense using javascript or typescript in a function which’s parameter is a string

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. Answer You can always see what vscode uses for intellisense by hovering on the addEventListener method or ctrl + click to go to the definition in

Type assert an element in a JS file with @ts-check

I have a JS file with a // @ts-check directive, using JSDoc comments to denote types. The problem is that the elements fail type checks when retrieved from the document. So we have in HTML: When I get this element in JS the type checking throws an error: Property ‘value’ does not exist on type ‘HTMLElement’ If I specify the

JSDoc: arrow function params

I’m trying to document my code with JSDoc (EcmaScript 2015, WebStorm 12 Build 144.3357.8). I have an arrow function which I want to document its parameters. This two examples work (I get auto-completion): But when I want to document an arrow function in forEach function, for example, the auto-completion isn’t working (all of the below): Has anyone managed to get

How to return void in JsDoc?

Is there a specified way to declare a method or a function to return void in JsDoc? Currently I am in the belief that void is the default return value, and other return values must be specifically provided: Answer I don’t believe you have to choose from a set of types in JsDoc… you can use any type name you

Advertisement