ts-unused 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import type { PropertyDeclaration, PropertySignature } from "ts-morph";
2
+ /**
3
+ * Extracts TODO comment text from the leading comments of a property.
4
+ * Returns undefined if no TODO comment is found.
5
+ */
6
+ export declare function extractTodoComment(prop: PropertySignature | PropertyDeclaration): string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Project } from "ts-morph";
2
+ import type { IsTestFileFn, NeverReturnedTypeResult } from "./types";
3
+ export declare function findNeverReturnedTypes(project: Project, tsConfigDir: string, isTestFile: IsTestFileFn, onProgress?: (filePath: string) => void, targetFilePath?: string): NeverReturnedTypeResult[];
@@ -0,0 +1,12 @@
1
+ import type { Project, PropertyDeclaration, PropertySignature } from "ts-morph";
2
+ /**
3
+ * Finds properties that are structurally equivalent to the given property.
4
+ * Two properties are structurally equivalent if they have:
5
+ * - Same property name
6
+ * - Same type signature
7
+ *
8
+ * This handles cases where properties are re-declared across interfaces,
9
+ * such as when one interface extends another and re-declares properties,
10
+ * or when spread operations flow values between structurally similar types.
11
+ */
12
+ export declare function findStructurallyEquivalentProperties(prop: PropertySignature | PropertyDeclaration, project: Project): Array<PropertySignature | PropertyDeclaration>;
@@ -0,0 +1,3 @@
1
+ import type { Project } from "ts-morph";
2
+ import type { IsTestFileFn, UnusedExportResult } from "./types";
3
+ export declare function findUnusedExports(project: Project, tsConfigDir: string, isTestFile: IsTestFileFn, onProgress?: (filePath: string) => void, targetFilePath?: string): UnusedExportResult[];
@@ -0,0 +1,3 @@
1
+ import type { Project } from "ts-morph";
2
+ import type { IsTestFileFn, UnusedPropertyResult } from "./types";
3
+ export declare function findUnusedProperties(project: Project, tsConfigDir: string, isTestFile: IsTestFileFn, onProgress?: (filePath: string) => void, targetFilePath?: string): UnusedPropertyResult[];
@@ -0,0 +1,13 @@
1
+ import type { IsTestFileFn } from "./types";
2
+ export interface FixResults {
3
+ fixedExports: number;
4
+ fixedProperties: number;
5
+ fixedNeverReturnedTypes: number;
6
+ deletedFiles: number;
7
+ skippedFiles: string[];
8
+ errors: Array<{
9
+ file: string;
10
+ error: string;
11
+ }>;
12
+ }
13
+ export declare function fixProject(tsConfigPath: string, onProgress?: (message: string) => void, isTestFile?: IsTestFileFn): FixResults;
@@ -0,0 +1,2 @@
1
+ import type { AnalysisResults } from "./types";
2
+ export declare function formatResults(results: AnalysisResults, tsConfigDir: string): string;
@@ -0,0 +1,2 @@
1
+ import type { SourceFile } from "ts-morph";
2
+ export declare function hasNoCheck(sourceFile: SourceFile): boolean;
@@ -0,0 +1,9 @@
1
+ export { analyzeProject } from "./analyzeProject";
2
+ export { fixProject } from "./fixProject";
3
+ export { formatResults } from "./formatResults";
4
+ export { findUnusedExports } from "./findUnusedExports";
5
+ export { findUnusedProperties } from "./findUnusedProperties";
6
+ export { isTestFile } from "./isTestFile";
7
+ export type { AnalysisResults, ExportKind, IsTestFileFn, NeverReturnedTypeResult, Severity, UnusedExportResult, UnusedPropertyResult, } from "./types";
8
+ export type { FixResults } from "./fixProject";
9
+ export type { PropertyUsageResult } from "./isPropertyUnused";