This commit is contained in:
79
src/types/ast.ts
Normal file
79
src/types/ast.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user