Merge pull request #31002 from Microsoft/fixIsStringIndexSignatureOnlyType

Fix isStringIndexSignatureOnlyType function
This commit is contained in:
Anders Hejlsberg
2019-04-17 17:19:34 -07:00
committed by GitHub
6 changed files with 82 additions and 1 deletions

View File

@@ -12049,7 +12049,7 @@ namespace ts {
}
function isStringIndexSignatureOnlyType(type: Type): boolean {
return type.flags & TypeFlags.Object && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, IndexKind.String) && !getIndexInfoOfType(type, IndexKind.Number) ||
return type.flags & TypeFlags.Object && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, IndexKind.String) && !getIndexInfoOfType(type, IndexKind.Number) ||
type.flags & TypeFlags.UnionOrIntersection && every((<UnionOrIntersectionType>type).types, isStringIndexSignatureOnlyType) ||
false;
}