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

Function getNameableDeclarationAtPosition

test/fixtures/snapshot/typescript.js:77529–77543  ·  view source on GitHub ↗
(signature, pos)

Source from the content-addressed store, hash-verified

77527 return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name));
77528 }
77529 function getNameableDeclarationAtPosition(signature, pos) {
77530 var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
77531 if (pos < paramCount) {
77532 var decl = signature.parameters[pos].valueDeclaration;
77533 return decl && isValidDeclarationForTupleLabel(decl) ? decl : undefined;
77534 }
77535 var restParameter = signature.parameters[paramCount] || unknownSymbol;
77536 var restType = getTypeOfSymbol(restParameter);
77537 if (isTupleType(restType)) {
77538 var associatedNames = restType.target.labeledElementDeclarations;
77539 var index = pos - paramCount;
77540 return associatedNames && associatedNames[index];
77541 }
77542 return restParameter.valueDeclaration && isValidDeclarationForTupleLabel(restParameter.valueDeclaration) ? restParameter.valueDeclaration : undefined;
77543 }
77544 function getTypeAtPosition(signature, pos) {
77545 return tryGetTypeAtPosition(signature, pos) || anyType;
77546 }

Callers 1

getRestTypeAtPositionFunction · 0.85

Calls 4

getTypeOfSymbolFunction · 0.85
isTupleTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…