UNPKG

dry-ts

Version:

Find candidate duplicate TypeScript code by comparing normalized AST structure.

38 lines (37 loc) 1.19 kB
export interface Location { readonly file: string; readonly startLine: number; readonly endLine: number; } export interface Nearest extends Location { readonly index: number; readonly shared: number; readonly total: number; readonly score: number; } export interface ClusterLocation extends Location { readonly nodes: number; readonly kind?: string; readonly name?: string | null; readonly nearest?: Nearest; readonly changed?: boolean; } export interface ScoreRange { readonly min: number; readonly max: number; } export type ClusterStatus = "new" | "known" | "unscoped"; export interface Cluster { readonly score: ScoreRange; readonly locations: readonly ClusterLocation[]; readonly status?: ClusterStatus; } export interface ClusterReport { readonly score: ScoreRange; readonly locationCount: number; readonly locations: readonly ClusterLocation[]; readonly status: ClusterStatus; } export declare const OUTPUT_FORMATS: readonly ["text", "edn", "json", "sarif"]; export type OutputFormat = (typeof OUTPUT_FORMATS)[number]; export declare function isOutputFormat(value: unknown): value is OutputFormat;