docascode / type2docfx

A tool to convert json format output from TypeDoc to universal reference model for DocFx to consume.
Apache License 2.0
17 stars 10 forks source link

Error when parsing properties with get/set #2

Closed ovasquez closed 6 years ago

ovasquez commented 6 years ago

I'm getting an error when processing the json output of Typedoc when it contains properties with getter or setters.

- Accessor: myModule.myComponent.enabled
S:\workspace\git\my-project\node_modules\type2docfx\dist\jsonTraverse.js:144
        var signatureType = node.getSignature ? node.getSignature[0].type : node.setSignature[0].type;

This error comes from an incorrect output of the get/set signatures from Typedoc (I opened an issue here https://github.com/TypeStrong/typedoc/issues/707) but since that repo seems kind of dead for fixes, I guess supporting both arrays and objects on this tool would make sense to allow using DocFX even if it's with partial support.

I can make a pull request with the fix but before spending time on it I'd like to have a green light on this.

Sample of problematic Typedoc output:

{
    "id": 332,
    "name": "enabled",
    "kind": 262144,
    "kindString": "Accessor",
    "flags": {
        "isExported": true
    },
    "getSignature": {
        "id": 333,
        "name": "__get",
        "kind": 524288,
        "kindString": "Get signature",
        "flags": {},
        "type": {
            "type": "intrinsic",
            "name": "boolean"
        },
        "inheritedFrom": {
            "type": "reference",
            "name": "ControlComponent.enabled",
            "id": 27
        }
    },
ovasquez commented 6 years ago

Hi @wuhanyumsft, sorry to ping you about this but this is a very important issue for generating typescript documentation. What do you think about a pull request that allows to match the existing get and set signature instead of just what the typedoc interface currently declares.

ovasquez commented 6 years ago

This issue seems to be fixed by #7, so I will close it.