Add type definitions
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-01-30 00:56:34 +00:00
parent 7c41c80734
commit 1ffdc08d97

79
src/types/ast.ts Normal file
View File

@@ -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;
}