Skip to content

Commit 07ff0fd

Browse files
committed
Properly handle mapped types with 'keyof any'
1 parent d940cda commit 07ff0fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5777,7 +5777,7 @@ namespace ts {
57775777
for (const propertySymbol of getPropertiesOfType(modifiersType)) {
57785778
addMemberForKeyType(getLiteralTypeFromPropertyName(propertySymbol), propertySymbol);
57795779
}
5780-
if (getIndexInfoOfType(modifiersType, IndexKind.String)) {
5780+
if (modifiersType.flags & TypeFlags.Any || getIndexInfoOfType(modifiersType, IndexKind.String)) {
57815781
addMemberForKeyType(stringType);
57825782
}
57835783
}
@@ -8386,7 +8386,7 @@ namespace ts {
83868386
}
83878387

83888388
function isMappableType(type: Type) {
8389-
return type.flags & (TypeFlags.TypeParameter | TypeFlags.Object | TypeFlags.Intersection | TypeFlags.IndexedAccess);
8389+
return type.flags & (TypeFlags.Any | TypeFlags.TypeParameter | TypeFlags.Object | TypeFlags.Intersection | TypeFlags.IndexedAccess);
83908390
}
83918391

83928392
function instantiateAnonymousType(type: AnonymousType, mapper: TypeMapper): AnonymousType {

0 commit comments

Comments
 (0)