Skip to content

Commit 663985e

Browse files
committed
Fix 'keyof any' to produce 'string | number'
1 parent 41c2054 commit 663985e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5713,7 +5713,7 @@ namespace ts {
57135713

57145714
function getIndexType(type: Type): Type {
57155715
return type.flags & TypeFlags.TypeParameter ? getIndexTypeForTypeParameter(<TypeParameter>type) :
5716-
getIndexInfoOfType(type, IndexKind.String) ? stringOrNumberType :
5716+
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringOrNumberType :
57175717
getIndexInfoOfType(type, IndexKind.Number) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
57185718
getLiteralTypeFromPropertyNames(type);
57195719
}

0 commit comments

Comments
 (0)