Merge pull request #8822 from Microsoft/excess-property-check-numeric-indexers

Excess property check numeric indexers
This commit is contained in:
Nathan Shively-Sanders committed 2016-05-26 13:39:29 -07:00
commit 0a623f8a71
38 files changed
+303 -163

No files matched your search

+4 -3
View File
@@ -6034,9 +6034,10 @@ namespace ts {
function isKnownProperty(type: Type, name: string): boolean {
if (type.flags & TypeFlags.ObjectType) {
const resolved = resolveStructuredTypeMembers(type);
if ((relation === assignableRelation || relation === comparableRelation) &&
(type === globalObjectType || isEmptyObjectType(resolved)) ||
resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) {
if ((relation === assignableRelation || relation === comparableRelation) && (type === globalObjectType || isEmptyObjectType(resolved)) ||
resolved.stringIndexInfo ||
(resolved.numberIndexInfo && isNumericLiteralName(name)) ||
getPropertyOfType(type, name)) {
return true;
}
}