import ts from "typescript"; import { TypeReference } from "./nodes/reference.ts"; /** * Retrieve and manage types referenced when parsing. */ export class TypeRegistry { private readonly _types: Record = {}; public getOrCreate(node?: ts.TypeNode): TypeReference | undefined { if (!node) { return undefined; } switch (node.kind) { case ts.SyntaxKind.TypeReference: { const a = node as ts.TypeReferenceNode; console.log(a.typeName.getText()); } break; case ts.SyntaxKind.ArrayType: { const b = node as ts.ArrayTypeNode; console.log("array", b.elementType?.getText()); } break; case ts.SyntaxKind.StringKeyword: console.log("string!"); break; } return undefined; } }