mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-28 09:22:42 -05:00
naive change and new tests
This commit is contained in:
@@ -6369,7 +6369,7 @@ namespace ts {
|
||||
// Assumed result is true. If check was not for a primitive type, remove all primitive types
|
||||
if (!typeInfo) {
|
||||
return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol,
|
||||
/*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false);
|
||||
/*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true);
|
||||
}
|
||||
// Check was for a primitive type, return that primitive type if it is a subtype
|
||||
if (isTypeSubtypeOf(typeInfo.type, type)) {
|
||||
@@ -6377,12 +6377,12 @@ namespace ts {
|
||||
}
|
||||
// Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is
|
||||
// union of enum types and other types.
|
||||
return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false);
|
||||
return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ true);
|
||||
}
|
||||
else {
|
||||
// Assumed result is false. If check was for a primitive type, remove that primitive type
|
||||
if (typeInfo) {
|
||||
return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false);
|
||||
return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ true);
|
||||
}
|
||||
// Otherwise we don't have enough information to do anything.
|
||||
return type;
|
||||
|
||||
Reference in New Issue
Block a user