@@ -14706,11 +14706,17 @@ namespace ts {
14706
14706
if (isFreshLiteralType(target)) {
14707
14707
target = (<FreshableType>target).regularType;
14708
14708
}
14709
- if (source === target ||
14710
- relation === comparableRelation && !(target.flags & TypeFlags.Never) && isSimpleTypeRelatedTo(target, source, relation) ||
14711
- relation !== identityRelation && isSimpleTypeRelatedTo(source, target, relation)) {
14709
+ if (source === target) {
14712
14710
return true;
14713
14711
}
14712
+ if (relation !== identityRelation) {
14713
+ if (relation === comparableRelation && !(target.flags & TypeFlags.Never) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) {
14714
+ return true;
14715
+ }
14716
+ }
14717
+ else {
14718
+ if (source.flags !== target.flags || source.flags & (TypeFlags.AnyOrUnknown | TypeFlags.Primitive | TypeFlags.NonPrimitive | TypeFlags.TypeParameter)) return false;
14719
+ }
14714
14720
if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) {
14715
14721
const related = relation.get(getRelationKey(source, target, IntersectionState.None, relation));
14716
14722
if (related !== undefined) {
@@ -18390,7 +18396,7 @@ namespace ts {
18390
18396
}
18391
18397
18392
18398
function isTypeOrBaseIdenticalTo(s: Type, t: Type) {
18393
- return isTypeIdenticalTo(s, t) || !!(s.flags & ( TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) && isTypeIdenticalTo(getBaseTypeOfLiteralType(s), t );
18399
+ return isTypeIdenticalTo(s, t) || !!(t.flags & TypeFlags.String && s.flags & TypeFlags.StringLiteral || t.flags & TypeFlags.Number && s.flags & TypeFlags.NumberLiteral );
18394
18400
}
18395
18401
18396
18402
function isTypeCloselyMatchedBy(s: Type, t: Type) {
0 commit comments