mirror of
https://github.com/olcubo/obsidian-cubox.git
synced 2026-07-22 05:43:25 +00:00
avoide casting to any
This commit is contained in:
parent
57cb30bd7c
commit
b3f4beaf25
2 changed files with 8 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { App, Notice, PluginSettingTab, Setting } from 'obsidian';
|
||||
import { App, Notice, PluginSettingTab, Setting, TextComponent } from 'obsidian';
|
||||
import type CuboxSyncPlugin from './main';
|
||||
import { FRONT_MATTER_VARIABLES } from './templateProcessor';
|
||||
import { ALL_FOLDERS_ID, FolderSelectModal } from './modal/folderSelectModal';
|
||||
|
|
@ -484,7 +484,7 @@ export class CuboxSyncSettingTab extends PluginSettingTab {
|
|||
// 更新 API Key 设置的描述和状态
|
||||
private updateApiKeySetting(): void {
|
||||
const domain = this.plugin.settings.domain;
|
||||
const textComponent = this.apiKeySetting.components[0] as any;
|
||||
const textComponent = this.apiKeySetting.components[0] as TextComponent;
|
||||
|
||||
if (!domain) {
|
||||
// 未选择域名
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export class TemplateProcessor {
|
|||
continue;
|
||||
}
|
||||
|
||||
const value = (article as any)[variable];
|
||||
const value = this.getArticleProperty(article, variable);
|
||||
if (value) {
|
||||
frontMatter[alias] = value;
|
||||
}
|
||||
|
|
@ -308,4 +308,9 @@ export class TemplateProcessor {
|
|||
|
||||
return highlightedContent;
|
||||
}
|
||||
|
||||
// 类型安全的辅助函数
|
||||
private getArticleProperty(article: CuboxArticle, propertyName: string): unknown {
|
||||
return (article as unknown as Record<string, unknown>)[propertyName];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue