@@ -10491,6 +10491,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
10491
10491
}
10492
10492
if (!type) {
10493
10493
let types: Type[] | undefined;
10494
+ let declarationsForTypes: Declaration[] | undefined;
10494
10495
if (symbol.declarations) {
10495
10496
let jsdocType: Type | undefined;
10496
10497
for (const declaration of symbol.declarations) {
@@ -10516,7 +10517,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
10516
10517
jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
10517
10518
}
10518
10519
if (!jsdocType) {
10519
- (types || (types = [])).push((isBinaryExpression(expression) || isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
10520
+ types = append(types, (isBinaryExpression(expression) || isCallExpression(expression)) ? getInitializerTypeFromAssignmentDeclaration(symbol, resolvedSymbol, expression, kind) : neverType);
10521
+ declarationsForTypes = append(declarationsForTypes, declaration);
10520
10522
}
10521
10523
}
10522
10524
type = jsdocType;
@@ -10525,7 +10527,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
10525
10527
if (!length(types)) {
10526
10528
return errorType; // No types from any declarations :(
10527
10529
}
10528
- let constructorTypes = definedInConstructor && symbol.declarations ? getConstructorDefinedThisAssignmentTypes(types!, symbol.declarations ) : undefined;
10530
+ let constructorTypes = definedInConstructor && declarationsForTypes ? getConstructorDefinedThisAssignmentTypes(types!, declarationsForTypes ) : undefined;
10529
10531
// use only the constructor types unless they were only assigned null | undefined (including widening variants)
10530
10532
if (definedInMethod) {
10531
10533
const propType = getTypeOfPropertyInBaseClass(symbol);
0 commit comments