Remove unnecessary check in getNarrowableTypeForReference (#47953)

* Remove unnecessary check in getNarrowableTypeForReference

* Add regression test
This commit is contained in:
Anders Hejlsberg
2022-02-18 20:03:48 +01:00
committed by GitHub
parent ddf17e0a76
commit db226a80e8
5 changed files with 231 additions and 1 deletions

View File

@@ -25081,7 +25081,7 @@ namespace ts {
const substituteConstraints = !(checkMode && checkMode & CheckMode.Inferential) &&
someType(type, isGenericTypeWithUnionConstraint) &&
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
return substituteConstraints ? mapType(type, t => t.flags & TypeFlags.Instantiable && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t) : type;
return substituteConstraints ? mapType(type, t => t.flags & TypeFlags.Instantiable ? getBaseConstraintOrType(t) : t) : type;
}
function isExportOrExportExpression(location: Node) {