MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / sameNamedValueOfType

Method sameNamedValueOfType

src/resolution/index.ts:5161–5166  ·  view source on GitHub ↗

* The value a file declares beside a type of the same name — `export * function Ok()` beside `export interface Ok`, a class merged with an * interface — which a call or `new` written with the name reaches. The * first by position; null when the file declares none.

(type: Node)

Source from the content-addressed store, hash-verified

5159 * first by position; null when the file declares none.
5160 */
5161 private sameNamedValueOfType(type: Node): Node | null {
5162 return this.context
5163 .getNodesInFile(type.filePath)
5164 .filter((n) => n.name === type.name && TYPE_COMPANION_VALUE_KINDS.has(n.kind))
5165 .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0] ?? null;
5166 }
5167
5168 private sameNamedTypeOfValue(value: Node): Node | null {
5169 if (value.kind !== 'constant' && value.kind !== 'variable') return null;

Callers 1

gateTargetKindMethod · 0.95

Calls 2

hasMethod · 0.80
getNodesInFileMethod · 0.65

Tested by

no test coverage detected