-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support unexported module functions #37
Comments
And I could be doing all of this wrong. I just want someone to know what the expectation is when writing a callback is. But it's not an exported function. |
The issue about So I can't tell if there are multiple things going on but any help would be appreciated. If you want some context, I'm trying to do this for path-loader and eventually for others once I get the simplest project done. |
I changed the description of this because it seems like |
I just got it somewhat working by marking |
I've also tried
I'll start debugging code. |
I'm not sure, maybe there are more problems. First about the case that you just want an unexported function inside a module, like that:
I think the correct way would be, to use the Unfortunately this will not work for now because there is a bug. (At the moment, you will get an unexported function, if you use I think we can fix this bug next week or so. |
Is that the right way to do this? I'm new to TypeScript in general. I've looked into some documentation and I can't tell if |
Actually a callback is a typedef. So for example if you have this documentation:
you will get this output:
The problem is, if you add the callback to a module. I just reproduced that. You can add the function and the callback to a namespace or you can add only the function to a module. That works fine. But if you add the callback to a module you will get the error message that you mentioned above:
This seems to be another bug! and I think we also can fix this during next week. |
That's correct. :) |
I will gladly help with a PR, this is blocking me. Let me see if I can figure out where this is failing and go from there. |
It looks like in the |
It looks like the JSDoc name and scope are not being used to identify whether or not something should be declared or exported. When I look at the JSDoc details for my file, it's clear that Any reason why these details are not used when identifying if/when things should be declared vs. exported? |
I stand corrected, you are using |
The problem with aliases in modules can simply be fixed by adding
Well we export by default everything that is not marked private. But you are right, that is not correct! We should rather use the export and the static flag. (We just added the behaviour for the private flag like JSDoc: @private but we forgot to change this case.) I added the fixes here: Additional I added two examples that use I'm really sorry but I cannot merge and publish this before next week. So if you need it now, maybe you can work with local changes. |
Your repository works fine. :) I've tested it and it works. Now to figure out why |
ok, these fixes seems to work. Just to clarify it: To describe a callback parameter, there are several ways to do this, and as often, there is no "right way". You can declare a function
or you can use arrow functions, for example:
As @tineheller mentioned, the alias-case has to �be added to the |
Fixed with #40 |
Let's say I've got the following JSDoc to describe a callback:
Right now, I have an NPM module that wants to describe a callback but it's not something exported. If I use
@callback
, I get the following error when generating the TSD:If I replace
@callback
with@function
, no error but the function is exported and I end up with something like this:I need a way within a
@module
to describe a callback so that it gets generated asdeclare function {MY_CALLBACK}
so that it's documented but not exported. (I'm new to TypeScript and TSD so bear with me please.)The text was updated successfully, but these errors were encountered: