mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 05:17:43 -05:00
isConstructorType checks base constraint for undefined
Previously, it assumed there was always a base constraint, which is true for correct code. For incorrect code, the base constraint may be missing, which caused a crash because the base constraint was undefined.
This commit is contained in:
@@ -3952,7 +3952,7 @@ namespace ts {
|
||||
}
|
||||
if (type.flags & TypeFlags.TypeVariable) {
|
||||
const constraint = getBaseConstraintOfType(<TypeVariable>type);
|
||||
return isValidBaseType(constraint) && isMixinConstructorType(constraint);
|
||||
return constraint && isValidBaseType(constraint) && isMixinConstructorType(constraint);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user