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:
Jarvis committed 2025-09-10 16:45:27 +02:00
1 parent bc689a6768
commit 2bd384fbd1
31 files changed
+204 -580

No files matched your search

+2 -7
View File
@@ -3,8 +3,8 @@
* Handles font discovery, caching, and retrieval for the plugin
*/
import { Notice } from 'obsidian';
import type { obsidianTypstPDFExport } from '../../main';
import { ExportErrorHandler } from '../core/ExportErrorHandler';
import { FALLBACK_FONTS } from '../core/constants';
import * as path from 'path';
@@ -74,12 +74,7 @@ export class FontManager {
console.error('Failed to cache fonts from typst:', error);
// Notify user of font caching failure (only if debug mode is enabled or if it's a critical error)
if (this.plugin.settings.behavior.debugMode) {
new Notice(`Font caching failed: ${error.message}. Using fallback fonts.`, 5000);
} else {
// For non-debug mode, show a more gentle notice
new Notice('Font list may be incomplete. Check debug mode for details.', 3000);
}
ExportErrorHandler.showFontError(error, !this.plugin.settings.behavior.debugMode);
// Create fallback cache file
const fallbackFonts = FALLBACK_FONTS;