mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 19:07:27 -06:00
Fix 'keyof any' to produce 'string | number'
This commit is contained in:
parent
41c20545e1
commit
663985eed0
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user