Skip to content

Commit 54d0bc7

Browse files
committed
revert unrelated
1 parent b19c64d commit 54d0bc7

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16782,7 +16782,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1678216782
// a subtype of just `A` or just `B`. When we encounter such a type parameter, we therefore check if the
1678316783
// type parameter is a subtype of a union of all the other types.
1678416784
if (source.flags & TypeFlags.TypeParameter && getBaseConstraintOrType(source).flags & TypeFlags.Union) {
16785-
if (isTypeStrictSubtypeOf(source, getUnionType(map(types, t => t === source ? neverType : t)))) {
16785+
if (isTypeRelatedTo(source, getUnionType(map(types, t => t === source ? neverType : t)), strictSubtypeRelation)) {
1678616786
orderedRemoveItemAt(types, i);
1678716787
}
1678816788
continue;
@@ -16816,7 +16816,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1681616816
}
1681716817
}
1681816818
if (
16819-
isTypeStrictSubtypeOf(source, target) && (
16819+
isTypeRelatedTo(source, target, strictSubtypeRelation) && (
1682016820
!(getObjectFlags(getTargetType(source)) & ObjectFlags.Class) ||
1682116821
!(getObjectFlags(getTargetType(target)) & ObjectFlags.Class) ||
1682216822
isTypeDerivedFrom(source, target)
@@ -28042,7 +28042,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2804228042
// the constituent based on its type facts. We use the strict subtype relation because it treats `object`
2804328043
// as a subtype of `{}`, and we need the type facts check because function types are subtypes of `object`,
2804428044
// but are classified as "function" according to `typeof`.
28045-
isTypeStrictSubtypeOf(t, impliedType) ? hasTypeFacts(t, facts) ? t : neverType :
28045+
isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? hasTypeFacts(t, facts) ? t : neverType :
2804628046
// We next check if the consituent is a supertype of the implied type. If so, we substitute the implied
2804728047
// type. This handles top types like `unknown` and `{}`, and supertypes like `{ toString(): string }`.
2804828048
isTypeSubtypeOf(impliedType, t) ? impliedType :
@@ -28276,17 +28276,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2827628276
getIntersectionType([type, candidate]);
2827728277
}
2827828278

28279-
// function strictSubtypeImpliesSubtype(source: Type, target: Type) {
28280-
// const s = source.flags;
28281-
// const t = target.flags;
28282-
// if (
28283-
// !(t & TypeFlags.Unknown && !(s & TypeFlags.Any))
28284-
// || !(s & TypeFlags.Object && t & TypeFlags.NonPrimitive && !(isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & ObjectFlags.FreshLiteral)))
28285-
// ) return false;
28286-
28287-
// return true;
28288-
// }
28289-
2829028279
function narrowTypeByCallExpression(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type {
2829128280
if (hasMatchingArgument(callExpression, reference)) {
2829228281
const signature = assumeTrue || !isCallChain(callExpression) ? getEffectsSignature(callExpression) : undefined;

0 commit comments

Comments
 (0)