mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge pull request #8822 from Microsoft/excess-property-check-numeric-indexers
Excess property check numeric indexers
This commit is contained in:
commit
0a623f8a71
38 files changed
+303
-163
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user