mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 22:55:36 -05:00
Handle intersections in isGenericTypeWithoutNullableConstraint (#50497)
* Handle intersections in isGenericTypeWithoutNullableConstraint * Add regression test
This commit is contained in:
@@ -25789,8 +25789,10 @@ namespace ts {
|
||||
!!(type.flags & TypeFlags.Instantiable && getBaseConstraintOrType(type).flags & (TypeFlags.Nullable | TypeFlags.Union));
|
||||
}
|
||||
|
||||
function isGenericTypeWithoutNullableConstraint(type: Type) {
|
||||
return !!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
|
||||
function isGenericTypeWithoutNullableConstraint(type: Type): boolean {
|
||||
return type.flags & TypeFlags.Intersection ?
|
||||
some((type as IntersectionType).types, isGenericTypeWithoutNullableConstraint) :
|
||||
!!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
|
||||
}
|
||||
|
||||
function hasContextualTypeWithNoGenericTypes(node: Node, checkMode: CheckMode | undefined) {
|
||||
|
||||
Reference in New Issue
Block a user