MCPcopy Create free account
hub / github.com/nodejs/node / getSignatureFromCalls

Function getSignatureFromCalls

test/fixtures/snapshot/typescript.js:157488–157504  ·  view source on GitHub ↗
(calls)

Source from the content-addressed store, hash-verified

157486 return checker.createAnonymousType(/*symbol*/ undefined, ts.createSymbolTable(), [getSignatureFromCalls(calls)], ts.emptyArray, ts.emptyArray);
157487 }
157488 function getSignatureFromCalls(calls) {
157489 var parameters = [];
157490 var length = Math.max.apply(Math, calls.map(function (c) { return c.argumentTypes.length; }));
157491 var _loop_16 = function (i) {
157492 var symbol = checker.createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, ts.escapeLeadingUnderscores("arg".concat(i)));
157493 symbol.type = combineTypes(calls.map(function (call) { return call.argumentTypes[i] || checker.getUndefinedType(); }));
157494 if (calls.some(function (call) { return call.argumentTypes[i] === undefined; })) {
157495 symbol.flags |= 16777216 /* SymbolFlags.Optional */;
157496 }
157497 parameters.push(symbol);
157498 };
157499 for (var i = 0; i < length; i++) {
157500 _loop_16(i);
157501 }
157502 var returnType = combineFromUsage(combineUsages(calls.map(function (call) { return call.return_; })));
157503 return checker.createSignature(/*declaration*/ undefined, /*typeParameters*/ undefined, /*thisParameter*/ undefined, parameters, returnType, /*typePredicate*/ undefined, length, 0 /* SignatureFlags.None */);
157504 }
157505 function addCandidateType(usage, type) {
157506 if (type && !(type.flags & 1 /* TypeFlags.Any */) && !(type.flags & 131072 /* TypeFlags.Never */)) {
157507 (usage.candidateTypes || (usage.candidateTypes = [])).push(type);

Callers 2

inferStructuralTypeFunction · 0.85
getFunctionFromCallsFunction · 0.85

Calls 5

_loop_16Function · 0.85
combineFromUsageFunction · 0.85
combineUsagesFunction · 0.85
mapMethod · 0.65
applyMethod · 0.45

Tested by

no test coverage detected