Variables of kind ConditionalExpression
have defaultValue set to condition
#401
Labels
bug
Functionality does not match expectation
Given the following TypeScript code, TypeDoc produces some incorrect output.
Source File:
Output:
What seems to be happening is that this is going through the variable converter, and inside of the switch statement, the
node.initializer.kind
value is193
("ConditionalExpression"
). This means that it hits thedefault
portion of the switch statement and sets the whole conditional as thedefaultValue
, which seems incorrect given TypeScript can determine the type for the conditional expression.I know that TypeScript can determine what the actual type is for the
assign
variable.I'm looking into how TypeDoc can infer this as well. What I am initially looking at is treating
ConditionalExpression
variable kinds as a special case in that case statement, and creating a new node converter to handle converting the conditional into a type. I'm still trying to determine how to create modify the variable reflection to have the correct type and be of the correct kind (the above screenshot should be marked as a function but it isn't) from the conditional. Does this sound like a reasonable approach?The text was updated successfully, but these errors were encountered: