Skip to content

Commit 40a5fc1

Browse files
committed
Handle intersections in isGenericTypeWithoutNullableConstraint
1 parent 6e8337e commit 40a5fc1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/checker.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -25789,8 +25789,10 @@ namespace ts {
2578925789
!!(type.flags & TypeFlags.Instantiable && getBaseConstraintOrType(type).flags & (TypeFlags.Nullable | TypeFlags.Union));
2579025790
}
2579125791

25792-
function isGenericTypeWithoutNullableConstraint(type: Type) {
25793-
return !!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
25792+
function isGenericTypeWithoutNullableConstraint(type: Type): boolean {
25793+
return type.flags & TypeFlags.Intersection ?
25794+
some((type as IntersectionType).types, isGenericTypeWithoutNullableConstraint) :
25795+
!!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
2579425796
}
2579525797

2579625798
function hasContextualTypeWithNoGenericTypes(node: Node, checkMode: CheckMode | undefined) {

0 commit comments

Comments
 (0)