Description
I noticed that intersection types were not supported in the json output so I thought I'd have a go at adding support myself. I've got it almost working by copying the code used for unions, but I'm not getting the 'id' values and since I'm new to the typedoc code base, and node programming, I thought I'd ask for a bit of advice on the direction to take.
Here's the commit of what I've done so far
natevoci@2c0589e
I've been testing with this typescript file
export interface IBar {
bar?: string;
}
export interface IFoo {
foo?: string;
}
type IIntersectionFooBar = IFoo & IBar;
let unionFooBar: IFoo | IBar;
The json output for the type of unionFooBar is
"type": {
"type": "union",
"types": [
{
"type": "reference",
"name": "IFoo",
"id": 4
},
{
"type": "reference",
"name": "IBar",
"id": 2
}
]
}
but for the IIntersectionFooBar type I get
"type": {
"type": "intersection",
"types": [
{
"type": "reference",
"name": "IFoo"
},
{
"type": "reference",
"name": "IBar"
}
]
}
as you can see the 'id' values are missing.
I'm guessing this is happening because this.reflection is not set in the ReferenceType class and the toObject() function has this
if (this.reflection) {
result.id = this.reflection.id;
}
but I haven't been able to find where the ReferenceType constructor is being called to understand if the 3rd 'reflection' parameter of the constructor can be set.
Am I on the right track? Is what i'm trying to do even possible? Any advice or tips on what to look at next would be appreciated.