(left, right, mapper)
| 58190 | return createSymbolWithType(left, thisType); |
| 58191 | } |
| 58192 | function combineUnionParameters(left, right, mapper) { |
| 58193 | var leftCount = getParameterCount(left); |
| 58194 | var rightCount = getParameterCount(right); |
| 58195 | var longest = leftCount >= rightCount ? left : right; |
| 58196 | var shorter = longest === left ? right : left; |
| 58197 | var longestCount = longest === left ? leftCount : rightCount; |
| 58198 | var eitherHasEffectiveRest = (hasEffectiveRestParameter(left) || hasEffectiveRestParameter(right)); |
| 58199 | var needsExtraRestElement = eitherHasEffectiveRest && !hasEffectiveRestParameter(longest); |
| 58200 | var params = new Array(longestCount + (needsExtraRestElement ? 1 : 0)); |
| 58201 | for (var i = 0; i < longestCount; i++) { |
| 58202 | var longestParamType = tryGetTypeAtPosition(longest, i); |
| 58203 | if (longest === right) { |
| 58204 | longestParamType = instantiateType(longestParamType, mapper); |
| 58205 | } |
| 58206 | var shorterParamType = tryGetTypeAtPosition(shorter, i) || unknownType; |
| 58207 | if (shorter === right) { |
| 58208 | shorterParamType = instantiateType(shorterParamType, mapper); |
| 58209 | } |
| 58210 | var unionParamType = getIntersectionType([longestParamType, shorterParamType]); |
| 58211 | var isRestParam = eitherHasEffectiveRest && !needsExtraRestElement && i === (longestCount - 1); |
| 58212 | var isOptional = i >= getMinArgumentCount(longest) && i >= getMinArgumentCount(shorter); |
| 58213 | var leftName = i >= leftCount ? undefined : getParameterNameAtPosition(left, i); |
| 58214 | var rightName = i >= rightCount ? undefined : getParameterNameAtPosition(right, i); |
| 58215 | var paramName = leftName === rightName ? leftName : |
| 58216 | !leftName ? rightName : |
| 58217 | !rightName ? leftName : |
| 58218 | undefined; |
| 58219 | var paramSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */ | (isOptional && !isRestParam ? 16777216 /* SymbolFlags.Optional */ : 0), paramName || "arg".concat(i)); |
| 58220 | paramSymbol.type = isRestParam ? createArrayType(unionParamType) : unionParamType; |
| 58221 | params[i] = paramSymbol; |
| 58222 | } |
| 58223 | if (needsExtraRestElement) { |
| 58224 | var restParamSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "args"); |
| 58225 | restParamSymbol.type = createArrayType(getTypeAtPosition(shorter, longestCount)); |
| 58226 | if (shorter === right) { |
| 58227 | restParamSymbol.type = instantiateType(restParamSymbol.type, mapper); |
| 58228 | } |
| 58229 | params[longestCount] = restParamSymbol; |
| 58230 | } |
| 58231 | return params; |
| 58232 | } |
| 58233 | function combineSignaturesOfUnionMembers(left, right) { |
| 58234 | var typeParams = left.typeParameters || right.typeParameters; |
| 58235 | var paramMapper; |
no test coverage detected