azu / azu/jsdoc-to-assert

Support class-specific callbacks

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
38
Forks
4
PR merge metrics
No merged PRs in 30d

Description

From: http://usejsdoc.org/tags-callback.html#examples
```js
/**
* @class
*/
function Requester() {}

/**
* Send a request.
* @param {Requester~requestCallback} cb - The callback that handles the response.
*/
Requester.prototype.send = function(cb) {
// code
};

/**
* This callback is displayed as part of the Requester class.
* @callback Requester~requestCallback
* @param {number} responseCode
* @param {string} responseMessage
*/
```

The above code results in the error: `Unexpected token, expected , `. Removing the `Requester~` prefix seems to make things happy, but then the callback is documented globally.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the JSDoc example in the issue and reproduce the `Unexpected token, expected ,` error using the `Requester~requestCallback` reference. Compare it with the unprefixed callback case; the work is done when class-specific callbacks parse successfully and remain documented as part of `Requester` rather than globally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.