mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Fix 'keyof any' to produce 'string | number'
This commit is contained in:
@@ -5713,7 +5713,7 @@ namespace ts {
|
||||
|
||||
function getIndexType(type: Type): Type {
|
||||
return type.flags & TypeFlags.TypeParameter ? getIndexTypeForTypeParameter(<TypeParameter>type) :
|
||||
getIndexInfoOfType(type, IndexKind.String) ? stringOrNumberType :
|
||||
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringOrNumberType :
|
||||
getIndexInfoOfType(type, IndexKind.Number) ? getUnionType([numberType, getLiteralTypeFromPropertyNames(type)]) :
|
||||
getLiteralTypeFromPropertyNames(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user