mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Make 'keyof readonly T' be the same as 'keyof T'
This commit is contained in:
@@ -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 :
|
||||
|
||||
Reference in New Issue
Block a user