Skip to content

Commit a50fd5f

Browse files
committed
Fix debug assert in getConstructorDefinedThisAssignmentTypes
1 parent e01ced0 commit a50fd5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10491,6 +10491,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1049110491
}
1049210492
if (!type) {
1049310493
let types: Type[] | undefined;
10494+
let declarationsForTypes: Declaration[] | undefined;
1049410495
if (symbol.declarations) {
1049510496
let jsdocType: Type | undefined;
1049610497
for (const declaration of symbol.declarations) {
@@ -10516,7 +10517,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1051610517
jsdocType = getAnnotatedTypeForAssignmentDeclaration(jsdocType, expression, symbol, declaration);
1051710518
}
1051810519
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);
1052010522
}
1052110523
}
1052210524
type = jsdocType;
@@ -10525,7 +10527,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1052510527
if (!length(types)) {
1052610528
return errorType; // No types from any declarations :(
1052710529
}
10528-
let constructorTypes = definedInConstructor && symbol.declarations ? getConstructorDefinedThisAssignmentTypes(types!, symbol.declarations) : undefined;
10530+
let constructorTypes = definedInConstructor && declarationsForTypes ? getConstructorDefinedThisAssignmentTypes(types!, declarationsForTypes) : undefined;
1052910531
// use only the constructor types unless they were only assigned null | undefined (including widening variants)
1053010532
if (definedInMethod) {
1053110533
const propType = getTypeOfPropertyInBaseClass(symbol);

0 commit comments

Comments
 (0)