Merge pull request #12671 from Microsoft/property-access-for-string-index-sigs

Property access for string index signatures
This commit is contained in:
Nathan Shively-Sanders
2017-01-18 08:38:33 -08:00
committed by GitHub
14 changed files with 123 additions and 23 deletions

View File

@@ -12444,6 +12444,10 @@ namespace ts {
}
const prop = getPropertyOfType(apparentType, right.text);
if (!prop) {
const stringIndexType = getIndexTypeOfType(apparentType, IndexKind.String);
if (stringIndexType) {
return stringIndexType;
}
if (right.text && !checkAndReportErrorForExtendingInterface(node)) {
reportNonexistentProperty(right, type.flags & TypeFlags.TypeParameter && (type as TypeParameter).isThisType ? apparentType : type);
}