mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge pull request #12671 from Microsoft/property-access-for-string-index-sigs
Property access for string index signatures
This commit is contained in:
commit
4759adefba
14 files changed
+123
-23
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user