Permit assignment this.xxx when class has index signature

This commit is contained in:
Anders Hejlsberg 2019-05-31 11:03:49 -07:00
parent 7dc1f40dc1
commit aaa55923e8

View File

@ -20192,7 +20192,7 @@ namespace ts {
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
const indexInfo = assignmentKind === AssignmentKind.None || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, IndexKind.String) : undefined;
const indexInfo = assignmentKind === AssignmentKind.None || !isGenericObjectType(leftType) || isThisTypeParameter(leftType) ? getIndexInfoOfType(apparentType, IndexKind.String) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;