Skip to content

Commit 09590bc

Browse files
committed
Transform 'keyof (A | B)' to 'keyof A & keyof B'
1 parent fc30bd1 commit 09590bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8268,7 +8268,8 @@ namespace ts {
82688268
}
82698269

82708270
function getIndexType(type: Type, stringsOnly = keyofStringsOnly): Type {
8271-
return type.flags & TypeFlags.Intersection ? getUnionType(map((<IntersectionType>type).types, t => getIndexType(t, stringsOnly))) :
8271+
return type.flags & TypeFlags.Union ? getIntersectionType(map((<IntersectionType>type).types, t => getIndexType(t, stringsOnly))) :
8272+
type.flags & TypeFlags.Intersection ? getUnionType(map((<IntersectionType>type).types, t => getIndexType(t, stringsOnly))) :
82728273
maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type, stringsOnly) :
82738274
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
82748275
type === wildcardType ? wildcardType :

0 commit comments

Comments
 (0)