(type)
| 58847 | return undefined; |
| 58848 | } |
| 58849 | function getDefaultConstraintOfConditionalType(type) { |
| 58850 | if (!type.resolvedDefaultConstraint) { |
| 58851 | // An `any` branch of a conditional type would normally be viral - specifically, without special handling here, |
| 58852 | // a conditional type with a single branch of type `any` would be assignable to anything, since it's constraint would simplify to |
| 58853 | // just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type, |
| 58854 | // in effect treating `any` like `never` rather than `unknown` in this location. |
| 58855 | var trueConstraint = getInferredTrueTypeFromConditionalType(type); |
| 58856 | var falseConstraint = getFalseTypeFromConditionalType(type); |
| 58857 | type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]); |
| 58858 | } |
| 58859 | return type.resolvedDefaultConstraint; |
| 58860 | } |
| 58861 | function getConstraintOfDistributiveConditionalType(type) { |
| 58862 | // Check if we have a conditional type of the form 'T extends U ? X : Y', where T is a constrained |
| 58863 | // type parameter. If so, create an instantiation of the conditional type where T is replaced |
no test coverage detected
searching dependent graphs…