Class specific callbacks
See original GitHub issueJSDoc defines class-specific callbacks as part of the standard callback convention: https://jsdoc.app/tags-callback.html
They do not appear to work in tsd-jsdoc because it just passes through the ~
character as part of the TS declaration name. As these are meta types, it shouldn’t be too hard to support them.
A naive approach would just be to remove ~ from any identifier when it is encountered during processing, which should work in 99% of the cases.
Another, possible more complete, approach is to change ~
to .
and write out the callback function definition as a member of the class the class-specific callback is on.
Is there any reason this would be difficult to add to tsd-jsdoc? I’m happy to submit a pull request with the code and relevant tests if you could point me in the right area of the code to get started.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
According to this:
#
is used for instance members..
is used for static members.~
is used for inner members.That seems like an oversight in the JSDoc docs. On the
@callback
page they use~
as the namepath connector, but on the “About Namepaths” page they do not mention callbacks at all. You could argue that a callback is somehow an “inner member” of a class but really it’s just an “idea” associated with the class, closest to an@interface
. Of course, those also use tilde-namepaths in the example, and they’re also conspicuously absent on the namepath page, so 🤷