-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class specific callbacks #132
Comments
Actually, looking at this with fresh eyes, it appears that class specific callbacks are supported! It's only the |
Switch to dot notation worked, and is an acceptable answer for my case (though working with ~ would be nice). So I'm closing this. Thanks for an awesome tool! |
I'm affected by this as well, would you consider reopening this issue, or should I create a new one? |
@glen-84 Is modifying your callbacks to use Technically this is a bug either way, so I suppose I'll re-open it, but I don't know if it will be addressed anytime soon. I would still like to dig into the code a little and see if it's an easy fix. |
I was trying to add type definitions to a project that I'm not the owner of (xlsx-populate). In theory I could probably change the syntax used or do a regex-replace on the generated definitions, but since this is supported JSDoc syntax, it would be better if it was supported without having to make any changes. However, I've just run into another issue with modules/exports, so IDK if I'll be able to use this library. |
PRs welcome. |
As a JSDoc yellow-belt, I don't really understand. Is there a difference in meaning between |
According to this:
|
Sounds like "namepath" is the magic word I was missing. Thanks! Does this mean that Matt's original documentation was technically using it wrong? I think he was documenting the public API, so not actually talking about "inner members" (sorta-kinda analogous to class private functions, but not really). For that matter, when is "inner member" syntax actually useful at all? The docs you linked say a namepath is for "referring to a JavaScript variable that is elsewhere in your documentation" -- if I'm documenting File A, why would I need to talk about some inner members in File B if there's no way for me to actually address them at runtime? That's the whole point of hiding the inner inside an inaccessible scope, right? |
He was documenting class-specific callbacks, as far as I know, which do use the tilde syntax.
That is answered on the same page:
|
That seems like an oversight in the JSDoc docs. On the |
JSDoc 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!
The text was updated successfully, but these errors were encountered: