(sourceParams, targetParams)
| 58157 | return result || ts.emptyArray; |
| 58158 | } |
| 58159 | function compareTypeParametersIdentical(sourceParams, targetParams) { |
| 58160 | if (ts.length(sourceParams) !== ts.length(targetParams)) { |
| 58161 | return false; |
| 58162 | } |
| 58163 | if (!sourceParams || !targetParams) { |
| 58164 | return true; |
| 58165 | } |
| 58166 | var mapper = createTypeMapper(targetParams, sourceParams); |
| 58167 | for (var i = 0; i < sourceParams.length; i++) { |
| 58168 | var source = sourceParams[i]; |
| 58169 | var target = targetParams[i]; |
| 58170 | if (source === target) |
| 58171 | continue; |
| 58172 | // We instantiate the target type parameter constraints into the source types so we can recognize `<T, U extends T>` as the same as `<A, B extends A>` |
| 58173 | if (!isTypeIdenticalTo(getConstraintFromTypeParameter(source) || unknownType, instantiateType(getConstraintFromTypeParameter(target) || unknownType, mapper))) |
| 58174 | return false; |
| 58175 | // We don't compare defaults - we just use the type parameter defaults from the first signature that seems to match. |
| 58176 | // It might make sense to combine these defaults in the future, but doing so intelligently requires knowing |
| 58177 | // if the parameter is used covariantly or contravariantly (so we intersect if it's used like a parameter or union if used like a return type) |
| 58178 | // and, since it's just an inference _default_, just picking one arbitrarily works OK. |
| 58179 | } |
| 58180 | return true; |
| 58181 | } |
| 58182 | function combineUnionThisParam(left, right, mapper) { |
| 58183 | if (!left || !right) { |
| 58184 | return left || right; |
no test coverage detected
searching dependent graphs…