(declarations, targetParameters, getTypeParameterDeclarations)
| 84020 | } |
| 84021 | } |
| 84022 | function areTypeParametersIdentical(declarations, targetParameters, getTypeParameterDeclarations) { |
| 84023 | var maxTypeArgumentCount = ts.length(targetParameters); |
| 84024 | var minTypeArgumentCount = getMinTypeArgumentCount(targetParameters); |
| 84025 | for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { |
| 84026 | var declaration = declarations_8[_i]; |
| 84027 | // If this declaration has too few or too many type parameters, we report an error |
| 84028 | var sourceParameters = getTypeParameterDeclarations(declaration); |
| 84029 | var numTypeParameters = sourceParameters.length; |
| 84030 | if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { |
| 84031 | return false; |
| 84032 | } |
| 84033 | for (var i = 0; i < numTypeParameters; i++) { |
| 84034 | var source = sourceParameters[i]; |
| 84035 | var target = targetParameters[i]; |
| 84036 | // If the type parameter node does not have the same as the resolved type |
| 84037 | // parameter at this position, we report an error. |
| 84038 | if (source.name.escapedText !== target.symbol.escapedName) { |
| 84039 | return false; |
| 84040 | } |
| 84041 | // If the type parameter node does not have an identical constraint as the resolved |
| 84042 | // type parameter at this position, we report an error. |
| 84043 | var constraint = ts.getEffectiveConstraintOfTypeParameter(source); |
| 84044 | var sourceConstraint = constraint && getTypeFromTypeNode(constraint); |
| 84045 | var targetConstraint = getConstraintOfTypeParameter(target); |
| 84046 | // relax check if later interface augmentation has no constraint, it's more broad and is OK to merge with |
| 84047 | // a more constrained interface (this could be generalized to a full hierarchy check, but that's maybe overkill) |
| 84048 | if (sourceConstraint && targetConstraint && !isTypeIdenticalTo(sourceConstraint, targetConstraint)) { |
| 84049 | return false; |
| 84050 | } |
| 84051 | // If the type parameter node has a default and it is not identical to the default |
| 84052 | // for the type parameter at this position, we report an error. |
| 84053 | var sourceDefault = source.default && getTypeFromTypeNode(source.default); |
| 84054 | var targetDefault = getDefaultFromTypeParameter(target); |
| 84055 | if (sourceDefault && targetDefault && !isTypeIdenticalTo(sourceDefault, targetDefault)) { |
| 84056 | return false; |
| 84057 | } |
| 84058 | } |
| 84059 | } |
| 84060 | return true; |
| 84061 | } |
| 84062 | function checkClassExpression(node) { |
| 84063 | checkClassLikeDeclaration(node); |
| 84064 | checkNodeDeferred(node); |
no test coverage detected
searching dependent graphs…