Skip to content

Commit 0389987

Browse files
committed
Allow maybeTypeOfKind to check if the type is any of the given types
1 parent 715542e commit 0389987

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27601,7 +27601,7 @@ namespace ts {
2760127601
// replaced with their constraints similar to the apparent type.
2760227602
if (
2760327603
inferenceContext &&
27604-
(contextFlags! & ContextFlags.Signature || maybeTypeOfKind(contextualType, TypeFlags.Conditional) || maybeTypeOfKind(contextualType, TypeFlags.IndexedAccess)) &&
27604+
(contextFlags! & ContextFlags.Signature || maybeTypeOfKind(contextualType, TypeFlags.Conditional | TypeFlags.IndexedAccess)) &&
2760527605
some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)
2760627606
) {
2760727607
// For contextual signatures we incorporate all inferences made so far, e.g. from return
@@ -33914,7 +33914,7 @@ namespace ts {
3391433914
// Return true if type might be of the given kind. A union or intersection type might be of a given
3391533915
// kind if at least one constituent type is of the given kind.
3391633916
function maybeTypeOfKind(type: Type, kind: TypeFlags): boolean {
33917-
if (type.flags & kind) {
33917+
if ((type.flags & kind) !== 0) {
3391833918
return true;
3391933919
}
3392033920
if (type.flags & TypeFlags.UnionOrIntersection) {

0 commit comments

Comments
 (0)