Make 'keyof readonly T' be the same as 'keyof T'

This commit is contained in:
Anders Hejlsberg
2017-07-19 16:18:07 -10:00
parent ecaa8b13c4
commit 97fb23b519
+3
View File
@@ -7530,6 +7530,9 @@ namespace ts {
}
function getIndexType(type: Type): Type {
if (type.flags & TypeFlags.Readonly || getObjectFlags(type) & ObjectFlags.Readonly) {
type = (<ReadonlyTypeVariable | ReadonlyObjectType>type).type;
}
return maybeTypeOfKind(type, TypeFlags.TypeVariable) ? getIndexTypeForGenericType(<TypeVariable | UnionOrIntersectionType>type) :
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :