jsdoc Questions

2

I'm currently converting a project from TypeScript to JavaScript with JSDoc. I'm trying to do the following but with JSDoc: declare global { namespace jest { interface Matchers<R> { toBeTh...
Isocline asked 24/11, 2020 at 14:20

3

I have been having a hard time getting the @borrows tag working in JSDoc. I have been trying to get the documentation from one function and us it as documentation for a second function. But I don't...
Lucillalucille asked 19/4, 2015 at 7:22

4

I have a simple method in API, that allows searching objects with JSONPath. As its syntax is pretty much unfamiliar to junior developers, i decided to provide some examples within JSDoc comment. Ye...
Doralin asked 19/4, 2012 at 8:1

2

I want to import a node module with @import, but it seems visual studio code is not getting it. Or am I doing it wrong?

4

In javascript, using JSDoc, I'm querying for an element on the page: // @ts-check /** @type {HTMLInputElement} */ const element = document.getElementById('checkbox'); But I get the warning: Type...
Thormora asked 10/11, 2022 at 1:19

6

Solved

For a function like this... function example() { var X = 100; ... var Y = 'abc'; ... return Z; } I need to explain the purpose of some of the local variables. Adding a description like ...
Raptor asked 1/8, 2016 at 21:57

1

My component's description on the Storybook Docs page is picking up extra tags stuff from the JSDocs in addition to the description. How can I go about displaying only the "description part&qu...
Natishanative asked 22/11, 2020 at 15:32

1

I have a JSDoc comment of a typedef like below, /** * Lorem ipsum dolor... * @typedef {Object} NotificationOptions * @property {boolean} foo - Property 1 * @property {boolean} bar - Property 2 ...
Bijouterie asked 7/12, 2021 at 4:2

3

Solved

I am trying to type the accumulator in a JavaScript reducer using JSDocs but cannot work out how to do this. I've tried typing it inline at initialization but that didn't work. Any hints or ideas?...
Carnot asked 3/9, 2018 at 15:16

3

Solved

I have an array of array of string and I can't figure out how to document that with JSDoc. /** @class */ function PostbackList() { /** @type {int} @default */ this.TypeID = 0; /** @type {Po...
Foretime asked 1/9, 2014 at 9:43

3

I'm looking for something like ESLint but that would actually validate types based on JSDoc @param tags. I tried ts-node but it doesn't seem to enforce it. For example this doesn't throw: /** * A...
Rhythmical asked 16/11, 2019 at 22:44

6

Solved

Let's say I have a file named "File1.js". In this file, I export an object of objects and I give each object a typedef, like so. /** * My typedef for each object. * @typedef {Object} MyObject1 ...
Scampi asked 14/4, 2018 at 22:8

6

Solved

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 writ...
Prospectus asked 13/6, 2014 at 23:11

8

Before giving up I wanted to give it a shot here. I have a definition file with typings like the following: /** * My json decode function, in reality very different * implementation (class like) ...
Walton asked 12/1, 2021 at 18:19

4

Solved

Given this code : function asyncFoo() { return new Promise(function (fulfill, reject) { doAsyncStuff(function(err, data) { if(err) reject(new Error(err)); else fulfill(new Bar(data)); }); }...
Yalta asked 8/3, 2016 at 13:48

4

Solved

I am new to using JSDocs and couldn't find an answer to this question. Suppose I wanted to write this simple function: function hasQ(array, item) {return array.includes(item);} which with JSDoc...
Virescence asked 14/5, 2018 at 11:59

3

Solved

I am trying to typehint a bunch of javascript in Google Script, and I have gotten as far as trying this: /** * Get (named) range given by name * * @param {String} name * @return {Range} * */...
Lineate asked 27/10, 2020 at 12:34

4

Solved

I have Mongoose schema and a model: var MyClientSchema = new mongoose.Schema({ fist_name: { type: String }, phone_number: { type: String } }); var MyClient = mongoose.model('MyClient', MyCl...
Metzgar asked 12/8, 2016 at 10:0

3

Solved

I'm not using typescript in my reactjs project, but I still want to document my components with JSDocs. The problem where is that I have a functional component with React.forwardRef and I want to c...
Saddletree asked 31/7, 2020 at 17:33

4

Solved

Is there a list somewhere of valid types for param tags for jsdoc? For example, @param {type} myParam Some parameter description I know that things like number and String are valid, but what if ...
Hajji asked 2/1, 2013 at 23:7

2

I have just started using Storybook for a UI component lib I am working on. I wanted to extract JSDoc written for JS class methods and properties into Storybook and create a Doc. Storybook does sup...
Luna asked 12/8, 2020 at 11:31

4

If I use JSDoc to create two objects, one of which has all of the properties of the other, how do I show that? For instance you'd have: /** * @typdef Foo * @type {Object} * @property {string}...
Ideation asked 8/2, 2017 at 21:32

3

Solved

Assuming a generic type below, what should I use in place of ??? to properly document T? /** * ??? The description of T. */ class MyClass<T> { } In C# I'd use <typeparam>. Is there a...
Matchbox asked 15/11, 2021 at 8:12

3

I'm trying to write documentation for a Module function like this: /** * Usage: * * ``` * @NgModule({ * imports: [ * BrowserModule, * ..., * ThisModule.forRoot({ * name: 'Name', * versio...
Sabaean asked 20/3, 2018 at 20:53

2

Solved

If I define the function as a variable object, then PhpStorm will show the auto-complete for the item parameter. /** * @param {Rules.FolderGroupItem} item **/ var forEach = function(item) { i...
Winnah asked 13/4, 2013 at 20:47

© 2022 - 2025 — McMap. All rights reserved.