File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -6828,6 +6828,7 @@ namespace ts {
6828
6828
6829
6829
function getTypeReferenceType(node: TypeReferenceType, symbol: Symbol) {
6830
6830
const typeArguments = typeArgumentsFromTypeReferenceNode(node); // Do unconditionally so we mark type arguments as referenced.
6831
+ let secondPass = true;
6831
6832
let fallbackType: Type = unknownType;
6832
6833
while (true) {
6833
6834
if (symbol === unknownSymbol) {
@@ -6844,18 +6845,22 @@ namespace ts {
6844
6845
6845
6846
if (symbol.flags & SymbolFlags.Value && node.kind === SyntaxKind.JSDocTypeReference) {
6846
6847
// A JSDocTypeReference may have resolved to a value (as opposed to a type). If
6847
- // the value has a construct signature, we use the return type of the construct
6848
- // signature as the type; otherwise, the type of this reference is just the type
6849
- // of the value we resolved to.
6848
+ // the symbol is a constructor function, return the inferred class type; otherwise,
6849
+ // the type of this reference is just the type of the value we resolved to.
6850
6850
if (symbol.flags & SymbolFlags.Function && (symbol.members || getJSDocClassTag(symbol.valueDeclaration))) {
6851
6851
return getInferredClassType(symbol);
6852
6852
}
6853
6853
6854
- fallbackType = getTypeOfSymbol(symbol);
6854
+ // Stop if this is the second pass
6855
+ if (secondPass) {
6856
+ return fallbackType;
6857
+ }
6855
6858
6856
6859
// Try to use the symbol of the type (if present) to get a better type on the
6857
- // next pass.
6860
+ // second pass.
6861
+ fallbackType = getTypeOfSymbol(symbol);
6858
6862
symbol = fallbackType.symbol || unknownSymbol;
6863
+ secondPass = true;
6859
6864
continue;
6860
6865
}
6861
6866
You can’t perform that action at this time.
0 commit comments