-
Notifications
You must be signed in to change notification settings - Fork 709
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
requires are included in the docs #1248
Comments
When you specify this, you tell TS that your files are not modules and everything defined in them is global. File mode should only be used for projects compiled with |
@Gerrit0 didn't help Managed to remove the require with From the PR you mentioned seems like another approach i tried before, generate declaration with tsc and feed typedoc the declarations and not the source. This works up to a point because i loose almost all the JSDocs comments not related to types, things like examples, param descriptions etc. Also with typedoc@next i get
and docs are empty. |
Ooh, that's good to know thanks! I thought TypeScript would allow CommonJS style exports to produce a symbol at the source file symbol... That's a bug with library mode then, we need to get module symbols for CommonJS modules some other way. |
@Gerrit0 |
Looks like you're right! PR welcome if you'd like to fix the docs. Modules mode should exclude it, but the issue with not being able to get the module symbol in library mode also applies to modules mode. typedoc/src/lib/converter/factories/declaration.ts Lines 87 to 98 in c296503
This is an issue that our tests didn't catch since they all use ES modules. Re-opening to track fixing it. |
So, I spent a couple hours digging into this. Unfortunately without success... TS knows that said file is a module, and it knows that it exports stuff, but I can't seem to figure out where to extract this information... I'm beginning to think it isn't exposed anywhere. You can work around this issue by documenting declaration files instead of the JS source. Not ideal, but... tsc --declaration --allowJS temp-dir.js
typedoc --includeDeclarations --excludeExternals temp-dir.d.ts |
Apparently TS 4.1 has improved this under the covers - the example file in - 0.20 beta 28 works as expected. |
Expected Behavior
Generated docs should include only exported functions
Actual Behavior
Generated docs include exported functions plus
const
's fromrequire
'sSteps to reproduce the bug
input file
config
How can i remove those const in the previous pic ? They are not exported and they are external and still they should up in the docs.
Thank you for your help.
Environment
The text was updated successfully, but these errors were encountered: