Skip to content

Commit c52eb6c

Browse files
committed
Indexed access any[K] has type any
1 parent b7e8a6d commit c52eb6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6033,6 +6033,9 @@ namespace ts {
60336033

60346034
function getIndexedAccessType(objectType: Type, indexType: Type, accessNode?: ElementAccessExpression | IndexedAccessTypeNode) {
60356035
if (maybeTypeOfKind(indexType, TypeFlags.TypeVariable | TypeFlags.Index) || isGenericMappedType(objectType)) {
6036+
if (objectType.flags & TypeFlags.Any) {
6037+
return objectType;
6038+
}
60366039
// If the index type is generic or if the object type is a mapped type with a generic constraint,
60376040
// we are performing a higher-order index access where we cannot meaningfully access the properties
60386041
// of the object type. In those cases, we first check that the index type is assignable to 'keyof T'

0 commit comments

Comments
 (0)