From 1ffdc08d971a136b752edcfe4de56e49ecf34452 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Fri, 30 Jan 2026 00:56:34 +0000 Subject: [PATCH] Add type definitions --- src/types/ast.ts | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/types/ast.ts diff --git a/src/types/ast.ts b/src/types/ast.ts new file mode 100644 index 0000000..dd30466 --- /dev/null +++ b/src/types/ast.ts @@ -0,0 +1,79 @@ +export interface TypeDeclaration { + name: string; + filePath: string; + startLine: number; + endLine: number; + kind: 'interface' | 'type_alias' | 'class' | 'enum' | 'function' | 'import'; + dependencies: string[]; + rawNode?: any; +} + +export interface InterfaceType extends TypeDeclaration { + kind: 'interface'; + members: InterfaceMember[]; + extends: string[]; + generics: GenericParameter[]; +} + +export interface TypeAlias extends TypeDeclaration { + kind: 'type_alias'; + typeAnnotation: string; + extends: string[]; + generics: GenericParameter[]; +} + +export interface ImportDeclaration extends TypeDeclaration { + kind: 'import'; + moduleName: string; + namedImports: string[]; + defaultImport?: string; + namespaceImport?: string; +} + +export interface InterfaceMember { + name: string; + type: string; + isOptional: boolean; + isReadonly: boolean; + modifiers: string[]; +} + +export interface GenericParameter { + name: string; + constraint?: string; + default?: string; +} + +export interface ParsedFile { + filePath: string; + types: TypeDeclaration[]; + imports: ImportDeclaration[]; + errors: ParseError[]; +} + +export interface ParseError { + message: string; + line: number; + column: number; + severity: 'error' | 'warning'; +} + +export interface TypeReference { + name: string; + module?: string; + isExternal: boolean; + location: { + filePath: string; + startLine: number; + startColumn: number; + endLine: number; + endColumn: number; + }; +} + +export interface TypeAnnotation { + text: string; + references: TypeReference[]; + isUnion: boolean; + isIntersection: boolean; +}