MCPcopy Index your code
hub / github.com/nodejs/node / getRestTypeAtPosition

Function getRestTypeAtPosition

test/fixtures/snapshot/typescript.js:77564–77589  ·  view source on GitHub ↗
(source, pos)

Source from the content-addressed store, hash-verified

77562 return undefined;
77563 }
77564 function getRestTypeAtPosition(source, pos) {
77565 var parameterCount = getParameterCount(source);
77566 var minArgumentCount = getMinArgumentCount(source);
77567 var restType = getEffectiveRestType(source);
77568 if (restType && pos >= parameterCount - 1) {
77569 return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
77570 }
77571 var types = [];
77572 var flags = [];
77573 var names = [];
77574 for (var i = pos; i < parameterCount; i++) {
77575 if (!restType || i < parameterCount - 1) {
77576 types.push(getTypeAtPosition(source, i));
77577 flags.push(i < minArgumentCount ? 1 /* ElementFlags.Required */ : 2 /* ElementFlags.Optional */);
77578 }
77579 else {
77580 types.push(restType);
77581 flags.push(8 /* ElementFlags.Variadic */);
77582 }
77583 var name = getNameableDeclarationAtPosition(source, i);
77584 if (name) {
77585 names.push(name);
77586 }
77587 }
77588 return createTupleType(types, flags, /*readonly*/ false, ts.length(names) === ts.length(types) ? names : undefined);
77589 }
77590 // Return the number of parameters in a signature. The rest parameter, if present, counts as one
77591 // parameter. For example, the parameter count of (x: number, y: number, ...z: string[]) is 3 and
77592 // the parameter count of (x: number, ...args: [number, ...string[], boolean])) is also 3. In the

Calls 10

getParameterCountFunction · 0.85
getMinArgumentCountFunction · 0.85
getEffectiveRestTypeFunction · 0.85
createArrayTypeFunction · 0.85
getIndexedAccessTypeFunction · 0.85
getTypeAtPositionFunction · 0.85
createTupleTypeFunction · 0.85
pushMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…