Skip to content

Commit d328ea0

Browse files
committed
Also remove nonInferrableAnyType, which looks like it should have flag NonInferrableType, but breaks if it does
1 parent af19747 commit d328ea0

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ namespace ts {
789789
const wildcardType = createIntrinsicType(TypeFlags.Any, "any");
790790
const errorType = createIntrinsicType(TypeFlags.Any, "error");
791791
const unresolvedType = createIntrinsicType(TypeFlags.Any, "unresolved");
792-
const nonInferrableAnyType = createIntrinsicType(TypeFlags.Any, "any", ObjectFlags.ContainsWideningType);
793792
const intrinsicMarkerType = createIntrinsicType(TypeFlags.Any, "intrinsic");
794793
const unknownType = createIntrinsicType(TypeFlags.Unknown, "unknown");
795794
const nonNullUnknownType = createIntrinsicType(TypeFlags.Unknown, "unknown");
@@ -9455,11 +9454,7 @@ namespace ts {
94559454
if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
94569455
reportImplicitAny(element, anyType);
94579456
}
9458-
// When we're including the pattern in the type (an indication we're obtaining a contextual type), we
9459-
// use the non-inferrable any type. Inference will never directly infer this type, but it is possible
9460-
// to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases,
9461-
// widening of the binding pattern type substitutes a regular any for the non-inferrable any.
9462-
return includePatternInType ? nonInferrableAnyType : anyType;
9457+
return anyType;
94639458
}
94649459

94659460
// Return the type implied by an object binding pattern
@@ -22493,7 +22488,6 @@ namespace ts {
2249322488
// Both types have the NonInferrableType flag set.
2249422489
const nonInferrable =
2249522490
getObjectFlags(source) & ObjectFlags.NonInferrableType
22496-
|| source === nonInferrableAnyType
2249722491
|| (priority & InferencePriority.ReturnType && (source === autoType || source === autoArrayType))
2249822492
|| isFromInferenceBlockedSource(source);
2249922493
if (nonInferrable) {

0 commit comments

Comments
 (0)