TypeStrong / typedoc

Documentation generator for TypeScript projects.
https://typedoc.org
Apache License 2.0
7.7k stars 697 forks source link

TypeDoc no longer outputs decorator information? #2157

Closed hrmcdonald closed 1 year ago

hrmcdonald commented 1 year ago

I'm not sure if this is a bug or if it is related to changes in Typescript itself, but we've used TypeDoc json output to help us generate documentation for an Angular component library for years. Unfortunately though, with the latest round of updates, TypeDoc seems to no longer be outputting decorator information. I saw no mention of a change related to this in the changelog.

This diminishes the usefulness of our documentation, so I wanted to check if anyone here might know how feasible it would be to get this functionality back. Am I just missing a special flag? Should we finally move on to custom AST parsing?

Expected Behavior

Previously decorator information for both classes and properties (and possibly methods) would be included like so:

image

Actual Behavior

Not a single decorators section exists in TypeDoc json output anymore.

Steps to reproduce the bug

Simply run typedoc configured to document any Angular component. Something like below in a fresh Angular CLI app:

npx typedoc --tsconfig ./tsconfig.json --json out.json --entryPointStrategy expand ./src/app

The output contains no decorator information.


This was during a project-wide update to Angular 15.x.x which requires Typescript 4.8.x+. This problem seems to happen with the latest TypeDoc version 0.23.24 and even the previous version we were on before the update ^0.21.0.

So I suspect the problem might have been a change in Typescript? Perhaps to do with changes in preparation of the tc39 decorators proposal?

Environment

Gerrit0 commented 1 year ago

reflection.decorates, reflection.decorators, and their corresponding interfaces have been removed as no code in TypeDoc used them.

In the 0.23.0 release notes.

I believe it may have been broken with newer TS versions before then. It wasn't ever properly tested, and TS has made several changes to how decorators are parsed/where they are located in the ast. I don't plan on adding support for it again without some way to display it in the default theme. I haven't tackled it because it means either including stringified arguments in typedoc's modem (ew), ignoring arguments (also probably not a good idea), or including the ast and serialization/deserialization for that (way too much code)

hrmcdonald commented 1 year ago

If anyone else finds themselves here for this very specific, niche use case. We were able to recreate most of the same output we previously pulled from Typdoc results from CompoDocs json output which is more suited for this specific task anyways.

Thanks for the quick response though @Gerrit0, you can close this.

Gerrit0 commented 1 year ago

👍 compodoc is probably a better solution for angular projects anyways, typedoc's goal is really to create documentation for libraries, not applications