sicua
Version:
A tool for analyzing project structure and dependencies
76 lines (75 loc) • 1.91 kB
TypeScript
/**
* Types for TypeScript type analysis
*/
export interface ComplexTypeInfo {
fileName: string;
context: string;
typeKind: string;
typeText: string;
}
export interface TypeSimplificationSuggestion {
fileName: string;
context: string;
typeKind: string;
typeCount: number;
suggestion: string;
}
/**
* Information about a duplicated type and its suggested replacement
*/
export interface TypeDuplication {
primaryType: {
name: string;
filePath: string;
location: {
line: number;
column: number;
};
};
duplicates: Array<{
name: string;
filePath: string;
location: {
line: number;
column: number;
};
matchScore: number;
}>;
suggestion: string;
importStrategy?: string;
}
/**
* Information about a suggested unified type
*/
export interface UnifiedTypeInfo {
possibleName: string;
baseTypes: string[];
properties: Record<string, string>;
usedIn: string[];
suggestedLocation: string;
}
/**
* Enhanced TypeAnalysisResult with new fields for type duplication detection
* and unified type suggestions
*/
export interface TypeAnalysisResult {
interfacesCount: number;
typesCount: number;
componentsWithPropTypes: string[];
componentsWithoutPropTypes: string[];
regularFunctionsWithoutReturnType: number;
suggestedImprovements: string[];
anyUsageCount: number;
broadUnionTypesCount: number;
complexTypes: ComplexTypeInfo[];
typeSimplificationSuggestions: TypeSimplificationSuggestion[];
duplicatedTypes: TypeDuplication[];
unifiedTypesSuggestions: UnifiedTypeInfo[];
typesByDirectory: Record<string, {
interfaces: string[];
types: string[];
enums: string[];
classes: string[];
}>;
typesWithoutNamespace: string[];
}