(left, right, mapper)
| 73198 | return createSymbolWithType(left, thisType); |
| 73199 | } |
| 73200 | function combineIntersectionParameters(left, right, mapper) { |
| 73201 | var leftCount = getParameterCount(left); |
| 73202 | var rightCount = getParameterCount(right); |
| 73203 | var longest = leftCount >= rightCount ? left : right; |
| 73204 | var shorter = longest === left ? right : left; |
| 73205 | var longestCount = longest === left ? leftCount : rightCount; |
| 73206 | var eitherHasEffectiveRest = (hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right)); |
| 73207 | var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest); |
| 73208 | var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0)); |
| 73209 | for (var i = 0; i < longestCount; i++) { |
| 73210 | var longestParamType = tryGetTypeAtPosition(longest, i); |
| 73211 | if (longest === right) { |
| 73212 | longestParamType = instantiateType(longestParamType, mapper); |
| 73213 | } |
| 73214 | var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType; |
| 73215 | if (shorter === right) { |
| 73216 | shorterParamType = instantiateType(shorterParamType, mapper); |
| 73217 | } |
| 73218 | var unionParamType = getUnionType([longestParamType, shorterParamType]); |
| 73219 | var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === (longestCount - 1); |
| 73220 | var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter); |
| 73221 | var leftName = i >= leftCount ? undefined : getParameterNameAtPosition(left, i); |
| 73222 | var rightName = i >= rightCount ? undefined : getParameterNameAtPosition(right, i); |
| 73223 | var paramName = leftName === rightName ? leftName : |
| 73224 | !leftName ? rightName : |
| 73225 | !rightName ? leftName : |
| 73226 | undefined; |
| 73227 | var paramSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* SymbolFlags.Optional */ : 0), paramName || "arg".concat(i)); |
| 73228 | paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType; |
| 73229 | params[i] = paramSymbol; |
| 73230 | } |
| 73231 | if (needsExtraRestElement) { |
| 73232 | var restParamSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "args"); |
| 73233 | restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount)); |
| 73234 | if (shorter === right) { |
| 73235 | restParamSymbol.type = instantiateType(restParamSymbol.type, mapper); |
| 73236 | } |
| 73237 | params[longestCount] = restParamSymbol; |
| 73238 | } |
| 73239 | return params; |
| 73240 | } |
| 73241 | function combineSignaturesOfIntersectionMembers(left, right) { |
| 73242 | var typeParams = left.typeParameters || right.typeParameters; |
| 73243 | var paramMapper; |
no test coverage detected
searching dependent graphs…