microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.74k stars 131 forks source link

The `readonly` modifier is not preserved #229

Closed arnog closed 4 years ago

arnog commented 4 years ago

The JSON output of tsdoc on this code fragment:

declare  class C {
 readonly p: string;
}

does not include a flag indicating that the property p is readonly:

{
    "id": 0,
    "name": "toplevel",
    "kind": 0,
    "flags": {},
    "originalName": "",
    "children": [
        {
            "id": 1,
            "name": "\"module.d\"",
            "kind": 1,
            "kindString": "Module",
            "flags": {
                "isExported": true
            },
            "children": [
                {
                    "id": 2,
                    "name": "C",
                    "kind": 128,
                    "kindString": "Class",
                    "flags": {
                        "isExported": true
                    },
                    "children": [
                        {
                            "id": 3,
                            "name": "p",
                            "kind": 1024,
                            "kindString": "Property",
                            "flags": {
                                "isExported": true
                            },
                            "type": {
                                "type": "intrinsic",
                                "name": "string"
                            }
                        }
                    ],
                    "groups": [
                        {
                            "title": "Properties",
                            "kind": 1024,
                            "children": [
                                3
                            ]
                        }
                    ],
                }
            ],
            "groups": [
                {
                    "title": "Classes",
                    "kind": 128,
                    "children": [
                        2
                    ]
                }
            ],
        }
    ],
    "groups": [
        {
            "title": "Modules",
            "kind": 1,
            "children": [
                1
            ]
        }
    ]
}
Gerrit0 commented 4 years ago

This looks like TypeDoc output, you'll probably want to open an issue at https://github.com/TypeStrong/typedoc/ instead

That said, TypeDoc only got support for readonly properties 5 days ago, and I haven't pushed that release yet (working on it now actually) https://github.com/TypeStrong/typedoc/pull/1268

arnog commented 4 years ago

Yep, my bad, I am using typedoc. Looks like this is a dupe of TypeStrong/typedoc#1268.