Skip to content

Commit fe075f2

Browse files
committed
Transform 'keyof (A & B)' to 'keyof A | keyof B'
1 parent f6418c0 commit fe075f2

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
@@ -7987,7 +7987,8 @@ namespace ts {
79877987
}
79887988

79897989
function getIndexType(type: Type): Type {
7990-
return maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type) :
7990+
return type.flags & TypeFlags.Intersection ? getUnionType(map((<IntersectionType>type).types, t => getIndexType(t))) :
7991+
maybeTypeOfKind(type, TypeFlags.InstantiableNonPrimitive) ? getIndexTypeForGenericType(<InstantiableType | UnionOrIntersectionType>type) :
79917992
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
79927993
type === wildcardType ? wildcardType :
79937994
type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :

0 commit comments

Comments
 (0)