DefSite

tcmts.core.extract.DefSite · #p3lnkmew · type

One top-level binding found in a source file.

import type { Piece } from "#codebase/tcmts/core/extract";
import type { DefKind, InitKind } from "#codebase/tcmts/core/types";
import type { Node as ts_Node, SourceFile as ts_SourceFile } from "typescript/ast";

export interface DefSite {
  id: number;
  sf: ts_SourceFile;
  name: string;
  kind: DefKind;
  /** roots of the definition's syntax; identifiers resolving inside these are locals */
  nodes: ts_Node[];
  /** tag used as the head of the definition's IR */
  tag: string;
  pieces: Piece[];
  initKind: InitKind;
  /** declarations (by node identity) that bind this definition's name */
  declarations: ts_Node[];
  doc?: string;
  isWatch: boolean;
  /** the identifier naming this definition (for signature lookup) */
  nameNode?: ts_Node;
  /** JavaScript can observe the declared name (`f.name`, `constructor.name`) */
  nominal: boolean;
  /** lineage salt giving the definition its own identity; see AnalyzeHost.saltFor */
  salt?: string;
  /** from a `// tcm: path a.b.c` comment: the codebase path to bind, regardless of namespace and declared name */
  targetPath?: string;
  /** bindings of one destructuring statement share a group: one component, emitted once */
  group?: number;
}

uses

used by