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

Method sameNamedValueOfType

src/resolution/index.ts:4770–4775  ·  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

4768 * first by position; null when the file declares none.
4769 */
4770 private sameNamedValueOfType(type: Node): Node | null {
4771 return this.context
4772 .getNodesInFile(type.filePath)
4773 .filter((n) => n.name === type.name && TYPE_COMPANION_VALUE_KINDS.has(n.kind))
4774 .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn)[0] ?? null;
4775 }
4776
4777 private sameNamedTypeOfValue(value: Node): Node | null {
4778 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