Skip to content

New API docs #8449

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

Closed
ahocevar opened this issue Jul 27, 2018 · 13 comments · Fixed by #8847
Closed

New API docs #8449

ahocevar opened this issue Jul 27, 2018 · 13 comments · Fixed by #8847

Comments

@ahocevar
Copy link
Member

ahocevar commented Jul 27, 2018

API doc generation no longer works after #8345. We need to find a new tool chain to generate API docs.

Possible options:

  1. A while ago, @tschaub and I started an effort in the site branch to use the output from tasks/generate-info.js as starting point for a Gatsby generated API documentation. This turns out to be a huge effort, almost equivalent to writing an API doc generator from scratch.

  2. Investigate tools like ESDoc, TypeDoc or not-yet-available tools that may come out of Microsoft's TSDoc effort.

  3. Generate *.d.ts files and see if there are tools to generate documentation from those.

Comments and thoughts on these options, or ideas for other options, are much appreciated.

@ahocevar
Copy link
Member Author

I have investigated TypeDoc a bit. I did not find a way to make it work with *.js files. Maybe it works if we are able to generate d.ts files? If so, how can we create those?

@ahocevar
Copy link
Member Author

ahocevar commented Jul 27, 2018

I am now investigating ESDoc. Will report here how that goes, but currently I'm stuck with Cannot read property 'charAt' of undefined errors.

@ahocevar
Copy link
Member Author

ahocevar commented Jul 27, 2018

ESDoc does not support import() type annotations, that's the reason for the errors I mentioned above.

@ahocevar
Copy link
Member Author

Actually there is hope that we can get things to work with TypeDoc. See TypeStrong/typedoc#643.

@ahocevar
Copy link
Member Author

ahocevar commented Aug 2, 2018

I have submitted TypeStrong/typedoc#824 to make TypeDoc work with typescript@next

@ahocevar
Copy link
Member Author

Looks like even with the above pull request, TypeDoc does not work properly with @typedef and @enum annotations.

@gberaudo
Copy link
Member

I am trying to make typedoc output something but I only get an empty documentation page:

git checkout ts
npm link typedoc  # to get latest version and I use typescript@next there
npx typedoc --out tsdoc src

@ahocevar, do you have a branch somewhere so I have a look to how you did it?

@ahocevar
Copy link
Member Author

ahocevar commented Aug 17, 2018

@gberaudo See https://github.com/openlayers/closure-es-modules/ for an example project. You need to set allowJs: 'true' in tsconfig.json's compilerOptions and use typedoc --tsconfig tsconfig.json to consume the configuration file.

@gberaudo
Copy link
Member

Thanks for your input @ahocevar, it helped a lot.

Strangely my issue was coming from the way I invoked typedoc.
I was passing the source directory like this:

npx typedoc --out tsdoc src  # matches the documentation but produces empty output

When omitting the source directory it does something (it is specified in tsconfig.json anyway):

npx typedoc --out tsdoc  # does something

@ahocevar
Copy link
Member Author

In the end, after way too much time spent trying to make TSDoc work for us, I went with JSDoc again. See #8847.

@marcjansen
Copy link
Member

Have you ever considered using https://documentation.js.org ? I didn't check the features / configurability but we have been using in some smaller projects and we are quite happy with it.

@ahocevar
Copy link
Member Author

@marcjansen I have, but it does not work well with modules, and not at all with TypeScript types unfortunately.

@marcjansen
Copy link
Member

Thanks for the info, @ahocevar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants