Ignore generic mapped types in isStringIndexSignatureOnlyType

This commit is contained in:
Anders Hejlsberg
2019-04-17 14:59:28 -07:00
parent 169e485d90
commit 9b3b8e3203

View File

@@ -12043,7 +12043,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;
}