We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c2644a commit 7740822Copy full SHA for 7740822
src/compiler/checker.ts
@@ -6921,7 +6921,8 @@ namespace ts {
6921
// over the conditional type and possibly reduced. For example, 'T extends undefined ? never : T'
6922
// removes 'undefined' from T.
6923
if (type.root.isDistributive) {
6924
- const constraint = getConstraintOfType(getSimplifiedType(type.checkType));
+ const simplified = getSimplifiedType(type.checkType);
6925
+ const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
6926
if (constraint) {
6927
const mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
6928
const instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
0 commit comments