Typedoc: Documentation for generated json file `--json`

Created on 1 Nov 2019  路  6Comments  路  Source: TypeStrong/typedoc

Is there a place where the codes & structure of the --json output are documented?

I need this to create a tool that can consume it.

Most helpful comment

v0.16.0 has a new export JSONOutput which types the outputted JSON.

The root symbol is JSONOutput.ProjectReflection

All 6 comments

936 adds types for the output, they don't all have doc comments, but it's a lot better than what's currently available.

Ow, that is a great job you're doing. Thanks.

When do you think this will get merged?

I'm just waiting for Anthony to have another look at the most recent changes, should be merged after that. I'm not sure when he'll have the time though.

v0.16.0 has a new export JSONOutput which types the outputted JSON.

The root symbol is JSONOutput.ProjectReflection

Thanks for this @Gerrit0, I've been following it for a few months so I'm happy to see it land.

A couple of questions I have after trying this out.

  • From what I understand, some reflections like those with kindStrings of "External module" and "Interfaces" have a property called children, but none of the exported reflection types have a property called children.

  • The DeclarationReflection model has a signatures property, but the exported DeclarationReflection type does not.

  • Please could you also clarify what type the root of the output JSON is. If I type it as JSONOutput.ProjectReflection I see a type error. Also the children property on the root of the output gets typed to any.

Conversion of type '{ "id": number; "name": string; "kind": number; "flags": {}; "originalName": string; "children": ({ "id": number; "name": string; "kind": number; "kindString": string; "flags": { "isExported": boolean; }; "originalName": string; "children": ({ ...; } | { ...; })[]; "groups": { ...; }[]; "sources": { ...; }[]; } | .....' to type 'ProjectReflection' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property 'groups' are incompatible.
    Type '{ "title": string; "kind": number; "children": number[]; }[]' is not comparable to type 'ReflectionGroup[]'.
      Type '{ "title": string; "kind": number; "children": number[]; }' is missing the following properties from type 'ReflectionGroup': flags, name, idts(2352)

Thanks! I believe that was just missed, checking the types now. The error with groups also looks like a bug. I guess I should have added a test to ensure importing the JSON as the serialized type doesn't give an error. Fix later today :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lsagetlethias picture lsagetlethias  路  3Comments

atomsoftwarestudios picture atomsoftwarestudios  路  4Comments

goodmind picture goodmind  路  3Comments

ShadowManu picture ShadowManu  路  4Comments

Bibliofile picture Bibliofile  路  3Comments