refactor: complete TypeScript type safety improvements
- Replace all 'any' types with proper TypeScript types throughout codebase - Fix processedResult parameters to use PreprocessingResult interface - Update UI modal types: app parameter (App), pluginDefaults (obsidianTypstPDFExportSettings) - Fix dropdown components to use DropdownComponent from Obsidian API - Replace plugin 'any' types with obsidianTypstPDFExport throughout converters - Fix margins parameter to use proper interface structure - Update fs parameter to use proper Node.js fs module type - Improve error handling with proper unknown type and type guards - Remove unused PdfEmbedProcessor and clean up imports Achieves complete type safety with zero remaining 'any' types across src/ directory. Provides better IDE support, compile-time error detection, and maintainability. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
31 files changed
+204
-580
No files matched your search
@@ -89,10 +89,11 @@ export class ImageOptimizer {
|
||||
});
|
||||
|
||||
return { success: true };
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
return {
|
||||
success: false,
|
||||
error: `JPEG conversion failed: ${error.message}`
|
||||
error: `JPEG conversion failed: ${errorMessage}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -163,12 +164,13 @@ export class ImageOptimizer {
|
||||
error: 'Could not parse dimensions from ImageMagick output'
|
||||
};
|
||||
}
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
console.warn('ImageMagick not available for image metadata, using fallback dimensions');
|
||||
return {
|
||||
dimensions: fallbackDimensions,
|
||||
success: false,
|
||||
error: `Failed to get image dimensions: ${error.message}`
|
||||
error: `Failed to get image dimensions: ${errorMessage}`
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -234,12 +236,13 @@ export class ImageOptimizer {
|
||||
success: true
|
||||
};
|
||||
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
return {
|
||||
imagePath: '',
|
||||
dimensions: { width: 0, height: 0 },
|
||||
success: false,
|
||||
error: `Image optimization failed: ${error.message}`
|
||||
error: `Image optimization failed: ${errorMessage}`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user