Skip to content
Advertisement

Tag: jsdoc

How to mark a property deprecated in a @typedef?

I would like to mark a property (for example, qux below) as deprecated: I should mention, I’d like to do this in a JSDoc comment, not using TypeScript. Answer According to Issue#131 over at tsdoc, you can actually use @deprecated on properties, you just have to set it inside the object (works with JS as well). For e.g.: Results in:

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

IntelliSense/JSDoc @param = @return, a.k.a. how do I document wrapper functions?

I have a function which takes in another function as an argument, does something to that function-argument, and then returns that same function-argument (or at least returns a function with the exact same signature to it) However, as you can see from my comments in the following… … IntelliSense will autocomplete when calling arbitraryFn() but not wrappedArbitraryFn(). Is there any

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

What’s the proper way to document callbacks with jsdoc?

I’ve spent quite a while scouring the internet looking for the best way to properly document callbacks with jsdoc, but unfortunately, I haven’t found a great one yet. Here’s my question: I’m writing a Node.js library for developers. This library provides multiple classes, functions, and methods that developers will be working with. In order to make my code clear and

Advertisement