Simplify or get constraint in distributive conditional type, but not both
This commit is contained in:
parent
7c2644a676
commit
7740822d02
1 changed files with 2 additions and 1 deletions
|
@ -6921,7 +6921,8 @@ namespace ts {
|
|||
// over the conditional type and possibly reduced. For example, 'T extends undefined ? never : T'
|
||||
// removes 'undefined' from T.
|
||||
if (type.root.isDistributive) {
|
||||
const constraint = getConstraintOfType(getSimplifiedType(type.checkType));
|
||||
const simplified = getSimplifiedType(type.checkType);
|
||||
const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
|
||||
if (constraint) {
|
||||
const mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
|
||||
const instantiated = getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
|
||||
|
|
Loading…
Reference in a new issue