fix: improve TypeScript type safety
- Replace any types with proper Obsidian API types - Add App type import for better type safety - Add ButtonComponent type for settings button parameter - Add null safety for button text content - Remove redundant "Settings" from settings tab heading 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2 files changed
+6
-6
No files matched your search
+4
-4
@@ -1,7 +1,7 @@
|
||||
// ABOUTME: Settings interface and SettingTab implementation for the Freewriting Prompts plugin
|
||||
// ABOUTME: Handles user configuration including API key, model selection, and prompt customization
|
||||
|
||||
import { App, Notice, PluginSettingTab, Setting } from 'obsidian';
|
||||
import { App, ButtonComponent, Notice, PluginSettingTab, Setting } from 'obsidian';
|
||||
import FreewritingPromptsPlugin from './main';
|
||||
import { FreewritingPromptsSettings, ANTHROPIC_MODELS, AnthropicModel } from './types';
|
||||
|
||||
@@ -28,7 +28,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
|
||||
containerEl.createEl('h2', { text: 'Freewriting Prompts Settings' });
|
||||
containerEl.createEl('h2', { text: 'Freewriting Prompts' });
|
||||
|
||||
// MARK: - API Configuration
|
||||
|
||||
@@ -185,8 +185,8 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
||||
|
||||
// MARK: - API Testing
|
||||
|
||||
private async testApiKey(button: any): Promise<void> {
|
||||
const originalText = button.buttonEl.textContent;
|
||||
private async testApiKey(button: ButtonComponent): Promise<void> {
|
||||
const originalText = button.buttonEl.textContent || 'Test Connection';
|
||||
|
||||
// Update button to show loading state
|
||||
button.setButtonText('Testing...');
|
||||
|
||||
Reference in new issue
Block a user