Skip to content

Commit 47bcfb3

Browse files
committed
Guard against missing constraint in getModifiersTypeFromMappedType
1 parent 8ae0376 commit 47bcfb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4612,8 +4612,8 @@ namespace ts {
46124612
// the modifiers type is T. Otherwise, the modifiers type is {}.
46134613
const declaredType = <MappedType>getTypeFromMappedTypeNode(type.declaration);
46144614
const constraint = getConstraintTypeFromMappedType(declaredType);
4615-
const extendedConstraint = constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
4616-
type.modifiersType = extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
4615+
const extendedConstraint = constraint && constraint.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>constraint) : constraint;
4616+
type.modifiersType = extendedConstraint && extendedConstraint.flags & TypeFlags.Index ? instantiateType((<IndexType>extendedConstraint).type, type.mapper || identityMapper) : emptyObjectType;
46174617
}
46184618
}
46194619
return type.modifiersType;

0 commit comments

Comments
 (0)