In JSDoc, the best documentation I can find shows to use the following if you have an array of a specific type (such as an array of strings) as: /** * @param {Array.<string>} myStrings All my awesome strings */ function blah(myStrings){...
How can I tell JSDoc about the structure of an object that is returned. I have found the @return {{field1: type, field2: type, ...}} description syntax and tried it: /** * Returns a coordinate from a given mouse or touch event * @param {TouchEven...
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 * @property {String} username Your userna...
How do I document a method in JavaScript using JSDoc when the parameter type can be mixed? I have method on a Dialog object where I can show HTML or my own Viewable objects. The method JSDoc looks like this: /** * Can pass in viewable object, or s...
I have an array that looks like this: [{ "name": "c917379", "email": "[email protected]" }, { "name": "c917389", "email": "[email protected]" }] It is an array of arbitrary length...
I have a function factory: function factory(events) { for(const key in events) { const { before, after } = events[key] } } Where the argument events is typically: { only: { before(){} after(){} }, except: { before(){}...
According to the JSDoc wiki for @param you can indicate a @param is optional using /** @param {String} [name] */ function getPerson(name) { } and you can indicate a param inline using function getPerson(/**String*/ name) { } And I can c...
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....
I have some code that returns a promise object, e.g. using Q library for NodeJS. var Q = require('q'); /** * @returns ??? */ function task(err) { return err? Q.reject(new Error('Some error')) : Q.resolve('Some result')...
I have 2 types of Modules: Require.js Main File: require.config({ baseUrl: "/another/path", paths: { "some": "some/v1.0" }, waitSeconds: 15, locale: "fr-fr" }); req...
©2020 All rights reserved.